Hi i using volley connection in my Android project, i want to connect to rest api. If i using curl the code is
curl -G -H "Content-type:application/json" -d "q={\"order_by\":[{\"field\":\"dates\",\"direction\":\"desc\"}]}" http://testurl/api/v1/test
And i do my volley connection like this
String x = "{\"order_by\":[{\"field\":\"dates\",\"direction\":\"desc\"}]}";
JSONObject jo;
try{
jo = new JSONObject(x);
JsonObjectRequest jreq = new JsonObjectRequest(Method.GET,
"http://testurl/api/v1/test",
jo, new Response.Listener<JSONObject>(){ @Override
public void onResponse(JSONObject response) {
try{Log.i("response",response.toString(3));}
catch(JSONException
},
new Response.ErrorListener() {@Override
public void onErrorResponse(VolleyError error) {
}
});
queue.add(jreq);
}
catch(JSONException e){}
connection success but result is not right, i guest because in in api must use q=JSON_SEARCH and in my volley connection i can't put q= in there..
Have anyone have some suggestion for my problem ?