I’m in a Losant workflow where I would like to access data from a device in a different Losant application.
I’m using a Device:Get node and finding by DeviceID and a string with the actual ID.
Is that not possible?
You cannot access data from an application within the context of a different application - such as in your use case here.
There is a workaround, however. Assuming you’re building a workflow in Application A and you want to access data from Application B, you can use an HTTP Node in your Application A workflow to make a request to …
- The Losant REST API directly, where you can query data from Application B
- A webhook or experience endpoint you’ve configured in Application B, which can kick off a workflow in Application B that issues a webhook reply or endpoint reply with the data you want to expose to Application A.
So if I’m using the HTTP Node to make a request to the Losant Rest API, do I need to set Headers for authentication, or am I automatically authenticated?
No, you’ll have to add all the necessary headers for authentication, which would mean generating an application API token in the application from which you want to retrieve data.
ok, so are those headers set in the “Request headers” section of the HTTP node configuration?
Yep. The header is:
Authorization: Bearer <your-api-token>
The header key is Authorization
and the value is the literal string “Bearer” followed by the API token for the other application.