Good day, been struggling a bit with this and not sure what to do anymore. I am using the android Asynchronus Http Library here to send a POST to parse but i keep getting this error message.
{"code":107,"error":"This endpoint only supports Content-Type: application/json requests, not application/x-www-form-urlencoded."}
here are the relevant parts of my code:
client = new AsyncHttpClient();
client.addHeader("Content-Type", "application/json");
client.addHeader("X-Parse-Application-Id", context.getResources().getString(R.string.app_id));
client.addHeader("X-Parse-REST-API-Key", context.getResources().getString(R.string.rest_api_key));
RequestParams params = null;
JSONObject json = new JSONObject();
try {
json.put(NAME, player_text.getText().toString());
json.put(CLUB, club_text.getText().toString());
} catch (JSONException e) {
e.printStackTrace();
}
params = new RequestParams("json",json); //takes a key value pair
client.post(context, url, params, responsehandler); // posting to https://api.parse.com/1/classes/ABCDER/
i have set the header content-type to application/json so i don't know why i am getting the error. i have also requested the getContentType from the params to see and it gives me the error PARSE was complaining about. What could i be doing wrong? Any help is highly Appreciated. Thanks in advance