Hi i am trying to set a value to my esp pin. But i am getting “404 not found” error every time.
With ifttt maker channel it works as a charm. Unfortunately i my custom app only error.
this is my post capture:
and the error from server:
Hi i am trying to set a value to my esp pin. But i am getting “404 not found” error every time.
With ifttt maker channel it works as a charm. Unfortunately i my custom app only error.
this is my post capture:
and the error from server:
anyone?
Hi. I don’t see the body in your request. Also you may try to use GET request instead - http://docs.blynkapi.apiary.io/#reference/0/write-pin-value-via-get/write-pin-value-via-get
i thought that the last part is body
by the way you can find my code details below:
private String url = "http://188.166.206.43/98e6bfe639004559aa855275e79358b7/update/d2";
JSONArray array = new JSONArray();
array.put("0");
String name = array.toString();
HttpURLConnection con = (HttpURLConnection) ( new URL(url)).openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type","application/json");
con.setDoInput(true);
con.setDoOutput(true);
con.connect();
con.getOutputStream().write(name.getBytes());
Please read link above carefully. It is GET
request with ?value=value
@Burak_Dogan GET looks fine:
http://188.166.206.43/98e6bfe639004559aa855275e79358b7/update/d2?value=0
http://188.166.206.43/98e6bfe639004559aa855275e79358b7/update/d2?value=1
I could be wrong, but try removing .getBytes() and just use name. Doesn’t .getBytes() return the byte value of the ascii string? Thus your 0 becomes 48.
instead:
con.getOutputStream().write(name);