Every time I get the error "BAD Request". I'm trying to post data like this json
{
"name":"testOne",
"location": "['one','two','three']"
}
Here is my Code
AsyncHttpClient client = new AsyncHttpClient();
String someData="{\"name\":\"testOne\",\"location\": \"['ne','two','three']\"}";
ByteArrayEntity be = new ByteArrayEntity(someData.toString().getBytes());
client.post(MainActivity.this, "http://impero-dannyfast.rhcloud.com/api/agents", be, "application/json", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Toast.makeText(MainActivity.this, "Succ", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Toast.makeText(MainActivity.this, "fail"+statusCode, Toast.LENGTH_SHORT).show();
}
});
try sending like this