api - publish data with a get http request

107 views
Skip to first unread message

Alexandre JACQUES

unread,
Apr 9, 2012, 1:23:02 PM4/9/12
to sens...@googlegroups.com
Hello,
As a fresh user of open.sen.se i want to connect my zibase, but this device can make only get http request (no post).
So I wonder if there is a 'get endpoint' in the api to make such devices post data, like
http://api.sen.se/events/feed/${feedID}/value=xxxx?sense_key=YOUR_SEN.SE_KEY

regards

Franck

unread,
Apr 10, 2012, 8:23:24 AM4/10/12
to Open.Sen.se Forum
Hello Alexandre,

As of today the only way to publish data in a feed is to make a POST
request. We may introduce a workaround in the future to allow devices
which cannot make such requests to publish data via a GET request.

Franck

On 9 avr, 19:23, Alexandre JACQUES <alexandre.j...@gmail.com> wrote:
> Hello,
> As a fresh user of open.sen.se i want to connect my zibase<http://zodianet.com/>,

CasaTechnogaian

unread,
Apr 24, 2012, 1:26:22 AM4/24/12
to Open.Sen.se Forum
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
Reply all
Reply to author
Forward
0 new messages