[Solved] Integrating Losant with external Rest API server


Hi Team,

I’m pretty new to Losant. I have integrated Losant with an api data source. Im storing and processing the data in Losant.

Data Source (Api) --> Losant —> Cloud (Rest Api)

After I process the data on Losant, I need to post the mutated data to another rest server hosted on another cloud. I have been trying with module Output> HTTP. But I think Im doing something wrong.

Let us say below is the request URL to which info has to go from Losant.

and below is the curl input that needs to be accompanied.
curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ -d ‘{ \
“$class”: “resource:abcd.com.LUpdate”, }’

What components should i use and how to post the mutated data update of a device to rest server in the downstream cloud server using rest api?

Abilash S



Are you pasting the curl command into the “Body Template” of the HTTP Node? That input should just be the data that you wish to send as the request body.

You can read more about this in the HTTP Node documentation, but for your particular example, you would set the following values in the node’s configuration:

In the “REQUEST HEADERS” section beneath the Body Template, you’ll add two entries:

  • Name: Accept
  • Value: application/json
  • Name: Content-Type
  • Value: application/json

As for the body of the request, I’m guessing the data you pass up will change depending on the trigger that fired the workflow, therefore you would want to se the body to be a JSON Template, which allows for inserting values from your payload into the request body.



Thank you soo much. It works like a charm!