Complete HTTP receiver or HTTP JSON receiver example... anywhere??
-
Hi. I am new to this product but have looked around the forum in many places and only see disjointed fragments of examples around how one goes about setting up an HTTP receiver or HTTP JSON receiver or TCP/IP receiver?
I am looking to import arduino data real-time into Mango, ideally using a TCP/IP or higher stack method. I can structure the data in whatever format but I need clear instructions on how the various UI parameters in the data source match to what is sent via a script, etc. Does something like that exist somewhere?
-
Hi Ceremona, welcome to the forum!
If you look at the '?' there is a full blown user help for how to utilise these sources.
As can be read, the url you need to post to is http://[mangodomain|localhost]/httpds
Anyway, you see that set point url I'm pointing to?
EDIT: Sorry I meant to mean device white list, I was pointing at the wrong textbox!
You set that as your reference so it will land (the data) in this datasource.
the parameter being__device
Here's a snippet:
var _URL="http://ipAddressHere/httpds?__device=DEMO&QUANTUMM1="+pt*.value+'@'+pt*.time; httpReq(_URL,"post",res,{'Content-Type':'application/x-www-form-urlencoded'},{});
Where in this case QUANTUMM1 is my point identifier in the data point in the data source itself.
The format as you can see in the code (1 of the allowed formats at least, read the datasource help for the others) is
"+pt*.value+'@'+pt*.time
So value first, separated by an '@' then a timestamp. NOTE This format I believe is the publisher set format for the set format option of this datasource so you can use a mango publisher to flick data via an http publisher to a mango http receiver datasource.So as a recap:
params: __device=[setPointUrl]
&httpParameterName=[value]@[Timestamp]url: mangoUrl/httpds
You can test by clicking on the 'Listen for HTTP data' button to ascertain if your values are coming through.
Any further confusion, we're all here to helpFox
-
Hi Ceremona, welcome to the forum!
I often link people to this post for the format of the publisher's output, which is what the HTTP Receiver is made to work with (though any client could send such HTTP messages, of course):
https://forum.infiniteautomation.com/topic/2187/how-to-use-publishers-http-sender/3Outgoing HTTP receiver messages are not quite the same formatting, as was discussed in this thread:
https://forum.infiniteautomation.com/topic/2854/http-receiver-set-point-nameFor the HTTP JSON receiver, you may find the last post in this thread answers the question:
https://forum.infiniteautomation.com/topic/4057/how-to-set-a-value-using-http/9The HTTP JSON receiver does not currently support settable points, so perhaps there is a useful feature to be added there.
-
Thanks Phil, I'll keep these in mind also