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() {
@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);
Hier ist der Code, den ich beim Senden von JsonRequest verwende. Mit der GET -Methode erhalte ich 400 Fehlerantwort von Server und der Server akzeptiert die Daten im URL -Formular nicht. Ich sende das JSONBODY -Objekt als Parameter. Irgendeine Lösung?
Wie dies, möchte ich JSON -Körperanfrage senden, um API zu erhalten.[code] 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() { @Override public void onResponse(JSONObject jsonObject) { Log.v("TAG", "Success " + jsonObject); callback.downloadQuestionsCallbacksSuccess(jsonObject.toString()); }
[/code] Hier ist der Code, den ich beim Senden von JsonRequest verwende. Mit der GET -Methode erhalte ich 400 Fehlerantwort von Server [b] und der Server akzeptiert die Daten im URL -Formular [/b] nicht. Ich sende das JSONBODY -Objekt als Parameter. Irgendeine Lösung?
Ich bin Anfänger von PHP und habe versucht, eine PHP -Datei zu schreiben, um Daten aus dem Internet abzukratzen und über AJAX in der HTML -Datei anzuzeigen. Mein Problem ist: Ich bekomme kein...
Ich habe in Android Studio eine App erstellt, die jede Art von Code (wie QR-Code, Barcode usw.) scannen kann, und ich möchte diese Daten in MongoDB speichern.
Dafür Ich baue eine API mit 2 Routen...