JsonObjectRequest jor = new JsonObjectRequest(JsonObjectRequest.Method.POST, url, json, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.d("glamour", response.toString());
Toast.makeText(WelcomeActivity.this, "onResponse: " + response.toString(), Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//Log.e("glamour", error.getMessage());
error.printStackTrace();
Toast.makeText(WelcomeActivity.this, "onErrorResponse: " + error.getMessage(), Toast.LENGTH_SHORT).show();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = new HashMap<>();
headers.put("Accept", "application/json");
headers.put("Content-Type", "application/json; charset=UTF-8");
return headers;
}
};
mQueue.add(jor);
erro info : BasicNetwork.performRequest: Unexpected response code 415 for http://192.168.1.103:8080/appapi/customer/login/v3
how to fix it? please help.
Http status code 415
from List of HTTP status codes
So check your media type declaration both at endpoint and client.