Hi, I would like to send a web request to the blynk cloud server from an Android app.
The following command works as expected:
curl --include --request PUT --header “Content-Type: application/json” --data-binary “[“255”]” ‘http://blynk-cloud.com/[MyToken]/update/V0’
putUrl(“http://blynk-cloud.com/[MyToken]/update/V0”) produces logcat message: “response:500”.
void putUrl(String urlString){
HttpClient httpclient = new DefaultHttpClient();
HttpPut httpPut = new HttpPut(urlString);
httpPut.setHeader(“Content-Type”, “application/json”);
httpPut.setHeader(“data-binary”, “255”);
try
{
HttpResponse response = httpclient.execute(httpPut);
Log.v(TAG, “response:”+response.getStatusLine().getStatusCode());
}
catch (IOException e)
{
Log.v(TAG,“Failed to execute httpput:”+e.getMessage());
e.printStackTrace();
}
}
Could I get some help? Thank you for your help in advance.