API Documents

It looks like you have change your documentation significantly. And really reduced its helpfulness. In particular there was a page that showed the parameters for an HTTPONREQUEST(req,res). The req had 5 elements such as req.query etc. I can no longer find this page and I am interesting in understanding this better.

Thanks for the catch @kenidowa - I’ll get that moved over this afternoon!

We moved a lot of documentation, so there’s bound to be a few things that we missed. Any old links from the devwiki that you had should still work - here’s a link to the page you were referencing: http://devwiki.electricimp.com/doku.php?id=electricimpapi:http:handler


I noticed a bit missing as well, but I know you are moving it. The new info and site are great! Keep up the good work.

When we moved the documentation, we aimed to increase it’s helpfulness (through rewriting some of the documentation, and almost all of the example code).

Feedback would be great - we’re nearing the point where we’ve moved most of what we believe to be important, but I’m sure we’re missing things.

The http.onrequest documentation has a link to the http handler documentation now :slight_smile:

The http handler doc includes information about the request table, as well as links to a couple useful examples.

Any chance there will be a Recent Changes button like was on the devwiki?

It made keeping up with things that were being updated significantly easier (everything was in one place).

There’s a Recent Changes button on the devwiki?

We’re generating our documentation from a set of markdown files that are hosted in a (private) GitHub repro - we should be able to figure something out - although this will be slightly lower in priority than a couple other important features… like searching :slight_smile:

I see the Http handler link now and is better than the old one, at least it looks more complete. I find the reference to the examples helpful. I had been using the RGBLED and the Snackbot was a good addition. But it doesn’t solve the problem I have been trying to do. That is send a request via a browser as the example in LEDRGB does but send information back from the imp device to the browser window with inbeded HTML code similiar to the Snackbot example. the response can send the HTML but the device info isn’t there yet.
Here’s a snippet:

`function httpHandler(req, resp) {

server.log("Method: "+req.method+" Path: "+req.path+" Query: "+req.query.code.tointeger()+" header: "+req.headers["accept-encoding"]+" Body: "+req.body);

if(“code” in req.query){
local code1=req.query.code.tointeger();
device.send(“Hello”,code1); //Send request to run Hello to imp device

   resp.send(200,"<!DOCTYPE html><html><head><title>Imp Agent</title></head>"+
    "<body>IMP Device info.<p>"+imp_D+"<p/></body></html>");
    server.log("Agent Code = "+code1);

The imp_D is data back from the Send but is not current with the device.send().

@kenidowa - I wrapped your code in < code > </ code> tags (the “C” button in the text formatting bar) so it looks a bit cleaner.

If I understand what you’re trying to do correctly, this post should help.

While still struggling with Squirrel, I use to get to the examples section a lot.
Have they really gone??

Only the navigation bar has actually been deleted; the rest of it is still there and is accessible via the site-map button. Honestly I’m a bit confused as to why this was done before the new documentation site was finished.


@DolfTraanberg - what did you use in the examples section?

All of the API docs have example code associated with them (although I suppose if you don’t know that hardware.pin.read() is how you read a pin, it could be hard to find).

We’re planning on having a new example section soon that will have examples for “read a button,” “read a sensor,” etc.

for example, the are some examples of array/table manipulation I always forget how to use and i don’t know where to look, besides that horrible official docs.
Searching the forum doesn’t work either that well anymore

Great! I will make sure we add some examples around array and table manipulation.

In the meantime, as Peter mentioned - you can still find pages using the site map, and if I understand correctly, I think this is the page you’re looking for:


thanks, it helps.

The documentation for agent.send at https://electricimp.com/docs/api/agent/send/ has typos (??) in the first few words under the “Description” heading. Not clear what the asterisks are about…

Looks likes the **'s are markup intending to make the enclosed text green, but maybe the “/” before confused the preprocessor…