Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

HTTP receiver : Polling an external site for JSON data


  • Hi,

    I have a URL that I can poll with an API key to get the following data :-

    {"result":[{"station_id":"SP","name":"South Perth","record_datetime":"2016-12-16 14:20:00","air_temp":"30.1","humidity":"26.1","soil_temp":"27.9","solar":"1002","rain":"0","dewpoint":"8.6","wind_speed_ave":"11.16","wind_speed_max":"15.88","wind_direction_deg":"98.9","wind_direction_comp":"E"}]}

    I have a number of questions ....

    The data point allows the 'Device Identifier Key' and Device Identifier ... Am I correct in assuming this is station_id and SP ?

    There is nothing on the UI to allow me to define that time stamp I need is record_datetime ... Am I correct in assuming it will use the time of polling ?

    I want to capture the air_temp ... I assume I set the HTTP parameter name to air_temp ... I have used the HTTP JSON receiver ... why does it not work / poll ?

    Thanks
    Jon K


  • "The HTTP receiver data source is used to accept data delivered to the system using HTTP GET or POST methods. Data can be delivered by anything that can act as an HTTP client, the most obvious example of which is a web browser, although there are many others"

    So data is PUSHED to Mango rather than PULL by Mango.

    Does this mean that the "Set point URL" should be where I want the data to go in Mango ?


  • Also .,... the HTTP Retriever is for Polling .... is there a JSON version of this ?


  • I think I have got it ....

    trying a HTTP receiver with .... Regex ...

    AIR TEMP : "air_temp"[ :]+((?=[)[[^]]]|(?={){[^}]}|"[^"]")
    TIMESTAMP : "record_datetime"[ :]+((?=[)[[^]]
    ]|(?={){[^}]}|"[^"]")


  • Hi espedair,

    I suspect you got it as well. There is not a JSON version of the receiver at the moment, but it would be relatively easy to add. Generally you can use regex to get most values and you don't need the arbitrary nesting of JSON, but I'm sure we'll add it at some point.

    To the questions you raised,

    "The data point allows the 'Device Identifier Key' and Device Identifier ... Am I correct in assuming this is station_id and SP ?"
    From the HTTP receiver help dialogue:
    "The device ID is specified in the HTTP request with the parameter name __device (with two underscores)."

    "There is nothing on the UI to allow me to define that time stamp I need is record_datetime ... Am I correct in assuming it will use the time of polling ?"
    The HTTP receiver accepts timestamps, You can see the format of messages it likes the most by capturing outgoing messages from the HTTP Publisher (which the receiver is made to work with, but is general enough to work with other services POSTing or GETing data. The Retriever solves this problem for you as you're expecting.

    "Does this mean that the "Set point URL" should be where I want the data to go in Mango ?"
    The Setpoint URL will get an HTTP message from Mango if within that Mango someone sets a value to the point. In general "Point Locators" tend to describe where data goes (by identifying a point!)