HTTP Request with few params

Hello.

I want to make an HTTP request with multiple parameters from the imp, something like
GET /sensors?temp=[temperature]&battery=[battery voltage]&key=1234

But now I can do only
GET /sensors?v=[temperature]

Code:
imp.configure("Sensors", [], [output]);

Is it possible to make such request?
Thanks.

If you do them as an array, so you have:

output.set([a,b,c])

…that will give you v=[a,b,c] in your request, I believe.

Hugo, thanks for reply.

I read about the OutputPort class and array format, but that’s not what I’m looking for. With this format I can not use the third party APIs such as Google Fusion Tables.

It will be great if I can use dictionary format

output.set({"temp" : a, "battery" : b, "key" : c})

but unfortunately it is not supported.

Blo, use a string in your Output port

`// Output to web service
local _impOut = OutputPort(“impOut”,“string”);

local a=1, b=2, c=3;
local jsonOut = “{‘temp’ :”+ a +", ‘battery’ :"+ b +", ‘key’ :"+ c +"}";
_impOut.set(jsonOut);`

Just tested post on http://requestb.in and works also on the HTTP Request Agent you can set content type to application/json

Thanks, controlCloud.

This is not exactly what I wanted, but at this moment it seems the only way to send multiple named parameters.