Using REST API working examples

Are there any working examples working of using the REST API to retrieve data from javascript? I have followed the examples described in the HTTP API reference but I am having trouble retrieving data from the server. This is likely due to inexperience of working with javascript on my part, but any help you could provide would be appreciated.

the examples are pretty detailed

if you haven’t written much javascript i suggest you download and famliarise yourself with postman

it has a great tool where you can get code written in your language


I am new to this, but… I have been able to read and write data using httprequest from amazon S3 services, yet still unsuccessful with the hologram rest API. What is confusing me is when I attempt to List the CSR messages as defined in the documentation the payload does not appear to be formatted in a text string or JSON. For example:

If I perform a GET for a simple text string “TEST MESSAGE” , the returned message is as follows:

{“success”:true,“continues”:true,“data”:[{“id”:4821890,“logged”:“2018-01-29 22:48:03.640075”,“orgid”:10264,“deviceid”:158298,“record_id”:“76f33472-0546-11e8-bd8e-bc764e200321”,“device_metadata”:"{}",“data”:"{“received”: “2018-01-29T22:48:03+00:00”, “authtype”: “deviceid”, “tags”: [“TESTME5”, “DEVICE_158298”, “RESTAPI”, “TAG_1224”], “device_name”: “Unnamed Device (06550)”, “source”: 158298, “record_id”: “76f33472-0546-11e8-bd8e-bc764e200321”, “data”: “IlRFU1QgTUVTU0FHRSI=”, “device_id”: 158298}",“matched_rules”:[],“tags”:[“TAG_1224”,“RESTAPI”,“DEVICE_158298”,“TESTME5”]}]}

Where is my payload?

Hi, the payload is in that “data” field and is base64encoded. If you base64decode the string IlRFU1QgTUVTU0FHRSI= you’ll get your original payload.

Hello, there is some method in which messages can be passed as soon as they arrive on the Hologram platform to another external service. What I would like to do is have the messages in an instance of NODE-RED as soon as they arrive on the platform. Could I do it in some way?

Hi John,

I haven’t used NodeRed before, but after a quick look at their site, it looks like you can send it webhooks. I would check out the Routes tab on the Dashboard and try the Advanced Webhook Builder for forwarding your messages. I hope that helps!

In the end it was much simpler than I expected.
1.On Hologram data router (Custom Webhook):
-Enter a Custom Webhook URL, which will be the URL for your Node-RED instance with any entry point that you want. For example:
-Enter your Verify key.

  1. On Node-RED instance
    -Drag and drop the following nodes onto the node-RED canvas:
  • Input http node
  • Output http response node
  • Function node
  • Output debug node

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.