Example of HTML In page syntax?

I’m trying to run an “HTML IN” input for my imp. Seems like this should be pretty straightforward, yet I’m missing something: So far as I can tell, the POSTed data never makes it to the implet. (imp + applet = implet?)


Clicking on HTTP IN, it tells me:
"External Service: HTTP in

To send messages in, HTTP POST to

https://api.electricimp.com/v1/9c8f4850e2543016/30dc5cd8da3f5c1c

with at minimum a value parameter and optionally a channel parameter."

Sounds easy.

I’m trying a few different syntaxes all at once:

 
    Imp!
 
 
    Control via Electric Imp!
   
     
     
     
     
   
   
     
     
     
     
   
 

…and so far as I can see, the data isn’t making it out of the HTTP IN node. I’ve noodled it to connect to a BLINK-O-MATIC node, and added a line server.show(inhibit) to that same implet to be double sure, and whether I press the 1 or 0 buttons on my form page, nothing changes.

Could we get an example of what a form that’s dumping to an HTTP IN node should look like?
This worked for me:

Is it possible to use HTTP GET instead of POST?

Hey guys,

We had a bit of an issue with the HTTP in node that should be fixed now. prototank, can you try your form again?

@reefangel: yep, you can use GET or POST. We may end up deprecating the GET as we improve the API, but for now it’s an option.

May I vote to keep GET as part of the API? It’d be a real shame to get rid of it (in my humble opinion, of course.)

Thanks, zvineyard. That worked for me.

How do I use GET and pass the parameters?

Tried my old example.

It’s still wouldn’t work for me, but I could see something I couldn’t before, now that I had the working example to alternate it with:

No matter which button I pressed, the blink-o-matic was set to “on”. That is, it got a non-zero value out. So that implied that it was hitting the HTTP IN node. Just that no matter what got put in, we never got a 0 out. (Even when it seemed like we should.)

Naturally, seeing that, I experimented some more.

Once I’d trimmed my code down to this version, it started working:
 
    Imp!
 
 
    Control via Electric Imp!
   
     
     
   
   
     
     
   
 

So something about the extra parameters was making it unhappy.

prototank, can you post your code (imp)?  I’m trying to tinker with the HTML IN and can’t seem to get the syntax right.

I’m just using the Blink-o-Matic code example, stock from the sample code list. 

http://devwiki.electricimp.com/doku.php?id=blinkomatic

There’s just one added line: 
    server.show(inhibit);
…just so I can get extra feedback.


Sam@prototank

So you linked the HTML In node to Blink-O-Matic, and you can turn it on and off from the HTML?


When I link to the LED control variable, I get a “node not found” when I try to do my HTML Posts.

Nevermind, I added a new HTML IN node and forgot to change the URL :frowning:

Just for reference, I figured out how to pass the parameter on GET request.
https://api.electricimp.com/v1/cfc48cf56a84f7e7/30a7691fd95fd25a/?value=1

@epall - I know this might sound crazy, however some devices (Okay, AMX controllers) do not support opening a secure connection. Is there any chance you can open up the API channel without SSL?

@jwjames83 Your wish is granted :slight_smile:

Awesome, thanks! I’ll play with it when I get back from vacation (no Internet / wifi here.)