I was wondering is there will be a HTTP Get node where you can have imp query values from external servers.
+1 for this feature.
Definitely a possibility. How much flexibility would you need? Just hit an arbitrary URL and send the results out as a hash?
>>From documentation: A few features, such as server side data storage, have yet to be added
Both have set of attributes e.g. ID, geo-location etc. A device is a thing/Imp
So if we could create a named collections of Imp’s i/o state or derived values and return as JSON
I was just thinking out loud.
How about just get something really simple as getting the response from a webserver.
Let’s say I host a webpage on a server that returns “1000”. How can I feed that number into imp?
I don’t have the server page up yet, but something like http://www.reefangel.com/testpage
We’re working on a more flexible way of doing this, allowing you to run server-side code that will deal with custom HTTP input/output (including synchronous state requests). There’s some groundwork to get done before that point though, so we can deliver something which is flexible and stable.
Hugo, this is great news! Let us know when you’ve opened up writing custom nodes (or at least server side code to customize HTTP interactions).
Hey guys,
Awesome.
Is it possible to pass parameters to the HTTP GET version? It works fine with POST (params are sent as part of the HTTP POST) but not when using GET (I would expect the parameters to show up after the URL, like http://www.someurl.here.com/whatever.cgi?param1=value1¶m2=value2 , etc).
Anyone figured out how to read an HTTP response yet?
The wiki says:
"If the response body is valid JSON (e.g. “foo”, 23, or [1,2,3]), it will
be parsed and emitted from the “response” output port on the block.
This allows you to asynchronously make requests to external services and
act on the response."
Anybody?
No I’ve had to encode using numbers for example 10 is channel 1 off, 11 channel 1 on 20/21 channel 2 on/off etc.
@controlCloud - I’ve logged a feature request. Thanks!
@jwjames83 - The only limit is your available free memory on the imp. I got up to around 12k (with a very small firmware) before it conked out.
@drazvan - That was a bug. It’s now fixed, but you don’t get to control parameter names. If you send a simple value, then you’ll get &value=blah on your URL. If you send an array, you’ll get &value=foo&value=bar on your URL. If you send and object, you’re SOL at this point. We have a much better way of doing this in the pipeline.
@mrjonandrews, @controlCoud - Can you send details of the issues you’re running into parsing responses to support@electricimp.com? It should be working.
I can tell you that HTTP In (or maybe it was a response from HTTP Post) doesn’t like null values in the JSON and doesn’t throw erros, it just skips the input. Took me a while to debug that little gotcha.