Hello Franck,
I have a device that does support HTTP POST but does not seem to
support any JSON classes as far as I can see.
Do you maybe have java example with the manual construction of a
string? (ergo, not using any json-tool)
I tried the following, but get 415 errors (probably something wrong
with string I guess)
************************
json_string = "{\"feed_id\" : 10753, \"value\" : \"25\"}";
try
{
String SENSE_URL = "
http://api.sen.se/events/?
sense_key=MySenSeKey";
URL url = new URL(SENSE_URL);
HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setConnectTimeout(TIMEOUT);
connection.setReadTimeout(TIMEOUT);
connection.connect();
Writer writer = new
OutputStreamWriter(connection.getOutputStream(), "UTF-8");
writer.write(json_string);
writer.flush();
BufferedReader in = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
String line = null;
while((line=in.readLine())!=null)
{
System.out.println(line);
}
int code = connection.getResponseCode();
and soforth...
************************
Thank you in advance for your support.
Regards, Rick