Will there be a HTTP Get node?

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?

It depends what server side storage looks
>>From documentation: A few features, such as server side data storage, have yet to be added

I have a simple physical world model of [site][device].[value]
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  
https://api.electricimp.com/v1/account_id/collection_id

I also use virtual sites to group devices from multiple locations.

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.


In the meantime you may need to use shims on another server to achieve what you want, sorry.

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,

As a stopgap to keep you hacking until we get proper server-side code working, we’ve added a few features to the HTTP request node:

1) GET, POST, PUT are all available now as an option along with URL
2) parse response and send it out as a message

Check out the updated docs at http://devwiki.electricimp.com/doku.php?id=httpapi for details and give it a spin!

Awesome.


I haven’t tried it out yet, but what is the max input from the request? Say I request something from a server that’s 2k - can the imp handle it?

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&param2=value2 , etc).


Razvan

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? :slight_smile:

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.


What would be great is a version of  HTTP IN (Get or Post) - 
where value is a String then you could JSON IN to an imp
Any chance of this e.imp?

@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.