Urgent Help Required: How to set and retreive data using publisher and HTTP Retriever data source
I want to set and retrieve the data from one device which listens for HTTP POST messages... I understand that i would be needing both data source and publisher, but how to connect them so that the data on Mango GUI is consistent with device status is not clear to me..
Kindly provide me help in this regard...
There is a possilbility that I may be missing something trivial as i am quite new to Mango M2M.
I've found the following helpful for first-time troubleshooting:
- open up the publisher in one window, and the retriever in another, and open both the publisher and receiver for editing.
- make sure the HTTP receiver is "listening" (click the "Listen for HTTP data" button), and for this test, leave devices and IP white lists at "" and "...*" respectively
- in the HTTP publisher. Make sure that the URL you are sending to (the HTTP receiver) is correct and in the form http://xxx.xxx.xxx.xxx:8080/httpds (if sending between machines) or http://localhost:8080/httpds if you're sending within the same machine.
- add some static information, for example, add a device in the "static parameters" filed called : Key: __device, Value: test and hit the green "+" to add the parameter. Now save this publisher using either a GET or POST method.
- push the "Send Static Data" button in your publisher. You should see a message show up in the listener window on the receiver.
This will get you started confirming a link. Once you've done that you can add points, setup whitelists for more secure connections, etc.
Thanks a lot for suggesting an innovative idea.
It has helped me in moving forward.
However as per my understanding, this will work only in case data is returned by device in the HTTP response header.
In my case , it is returning the data in the HTTP Body and not in the headers.
Kindly suggest how HTTP Reciever can be modified to get the data from body also.
Thanks in advance,
So now you have the two instances (or internally in the one instance) communicating right? (you can pass the "static data"). In order to pass real data in the body and store it, try the following.
- if you have some real data points to send, make a new publisher like the one we did previously. Make sure you save the publisher. I don't think Mango will let you add real datapoints until you save the publisher. If you don't have any real data to pass yet then make a "Virtual Data Source" and add a point to make random numbers every 30 seconds or so.
- Now we're going to add data points to the publisher. Select one of your real data points that you have or the one you made as a "Virtual Data Source" in the pull down menu at the bottom of the page. Select one or more datapoints to send.
- In order to properly send the data, you will have to name the "parameter" (datapoint). This is the same parameter name you will use on the HTTP Receiver end to listen for the datapoint and add it to your database. Make sure that you have selected "All Updates" on the "update events" box. This means that any time a new datapoint changes in a way that the sending instance considers worthy of logging it will send the value to your receiver (timestamp, value or either depending on how your logging is setup).
- On the receiver end, you will need to setup the points you are listening for. In the HTTP Receiver that you have already confirmed is sending static data (from the previous exercise), you will need to add some receiver points. Again, you have to save the HTTP Receiver, or it won't let you add data points. Once you do this, you can add a new receiver point by clicking the green circle with the arrow at the bottom of the screen. The new point should be of the same data type as the publisher (binary, numeric, alphanumeric, etc). You will also need to put the exact same parameter name here as you put in the publisher for the data point (this is case sensitive so it has to be EXACT). Save the datapoint once you have entered all of the information.
- Now that you have a data point configured, make sure you turn the datapoint on, and the data source. You can click on the red balls for the datapoint and the data source to toggle them green. The receiver will only receive and store data if these are green. Also, make sure that your HTTP Publisher has the "Enabled" checkbox checked (or that there is a green ball on the status under the "Publishers" page)
- that's really it.... you should now be passing and storing data for the datapoint you added. If you want to quickly confirm this, you can click on the "Watchlist" and add the point you just added to the current watchlist (so you can see the most recent value, and some charting over time).
Hope this helps,