Greetings, so i am using the custom code service and however i am having problems i need light on this, and there no information addressing this directly.. i would like to access my custom code via the url and i get error, this is my code please help
try{
JSONObject json = new JSONObject();
try {
json.put(Dictionary.JSON_KEY_OPERATION,
Dictionary.OPERATION_AUTHENTICATE_USER_TOKEN);
} catch (JSONException e) {}
try {
json.put(Dictionary.JSON_KEY_DATA_INPUT_EMAIL, MainActivity.txtD.email);
} catch (JSONException e) {}
try {
json.put(Dictionary.JSON_KEY_DATA_INPUT_NUMBER, MainActivity.txtD.number);
} catch (JSONException e) {}
try {
json.put(Dictionary.JSON_KEY_DATA_INPUT_PIN_CODE, ed.getText().toString());
} catch (JSONException e) {}
HttpURLConnection httpcon = (HttpURLConnection)
((new URL (Dictionary.URL).openConnection()));
httpcon.setDoOutput(true);
httpcon.setRequestProperty("Content-Type", "application/json");
httpcon.setRequestProperty("Accept", "application/json");
httpcon.setRequestMethod("POST");
httpcon.connect();
OutputStream os = httpcon.getOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(os, "UTF-8"));
writer.write(json.toString());
writer.close();
os.close();
}catch(Exception d){
d.printStackTrace();
}
and the error code i get is 400 - bad request , is this the right way to go, can i have a demo that uses my way