I am trying to call an API through android it is giving invalid request error.
while API giving the correct result in POSTMAN.
I am using the following code . Is something wrong in following code.
String url ="http://apiaddress";
// POST parameters
Map<String, String> params = new HashMap<String, String>();
params.put("tag", "test");
JSONObject jsonObj = new JSONObject(params);
// Request a json response from the provided URL
JsonObjectRequest jsonObjRequest = new JsonObjectRequest
(Request.Method.POST, url, jsonObj, new Response.Listener<JSONObject>()
{
@Override
public void onResponse(JSONObject response)
{
System.out.print("JSOn Object:"+jsonObj.toString());
}
});