like this, I want to send json body request to GET API
tried this but not worked
public static void getQuestionsListApi2(final String requestId, final String timestamp,
final ImageProcessingCallback.downloadQuestionsCallbacks callback,
final Context context) {
try {
String url = NetUrls.downloadQuestions;
final JSONObject jsonBody = new JSONObject();
jsonBody.put("requestId", requestId);
jsonBody.put("timestamp", timestamp);
final String mRequestBody = jsonBody.toString();
Log.i("params", String.valueOf(jsonBody));
Log.i("URL", url);
JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, **jsonBody**, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
Log.v("TAG", "Success " + jsonObject);
callback.downloadQuestionsCallbacksSuccess(jsonObject.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Log.v("TAG", "ERROR " + volleyError.toString());
}
});
request.setRetryPolicy(new DefaultRetryPolicy(
DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
RequestQueue queue = Volley.newRequestQueue(context);
queue.add(request);
} catch (JSONException e) {
e.printStackTrace();
}
}
request.setRetryPolicy(new DefaultRetryPolicy(
DefaultRetryPolicy.DEFAULT_TIMEOUT_MS * 0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
RequestQueue queue = Volley.newRequestQueue(context);
queue.add(request);
Here Is the Code that i am using when sending JSONRequest with GET Method i am getting 400 error response from server and server not except the the data in the url form . I am sending The jsonBody object as parameter. any solution.