HTTP Outbound in Workflow

As part of HTTP Outbound inside a workflow -

  • How do I get access to Device specific attribute
  • How do I get access to Parent Device Attribute
  • Application Token – Similar to Losant API’s , Our APIs we integrate with are OAuth protected, I did not find an option in Security section to get a Bearer Token(do I need to do a 2-step process, one HTTP step call to get Token and then second HTTP step to call the service with Bearer token retrieved from Step 1).Is there easier way to say cache these tokens for a set duration and use it.

How do I get access to Device specific attribute

The Device: Get Node can optionally return the most recent attribute values for any configured attributes. Additionally, the Data: Gauge Query Node and Data: Time Series Node are other ways to query attribute data for a specific device.

How do I get access to Parent Device Attribute

You can obtain the device ID for a parent system using the Device: Get Node. The parent ID is on the resulting object at parentID. You can then use the same nodes as above to retrieve attribute values for the parent device.

Application Token – Similar to Losant API’s , Our APIs we integrate with are OAuth protected, I did not find an option in Security section to get a Bearer Token(do I need to do a 2-step process, one HTTP step call to get Token and then second HTTP step to call the service with Bearer token retrieved from Step 1).Is there easier way to say cache these tokens for a set duration and use it.

As you mentioned, this requires a two-step process. You must first obtain a token from your service, which can then be used in subsequent calls. As for caching the token, I recommend either Workflow Storage or a Data Table.

I tend to use Workflow Storage for things like this. If these tokens are per-user, you can use the user’s ID as the storage key. For the value, I recommend concatenating the token and creation date together. This way you can quickly check when the token was created by splitting the value by the concatenation character (I usually use a |). If the token was created too long ago, you can request a new token and update the workflow storage value. Check out the String Node for splitting values and the Date/Time Node for calculating the difference between timestamps (e.g. “how long ago was this token created”).

Hi @Brandon_Cannaday Thanks. Now what I exactly need is not just the device ID and parent Device Id but also some attributes which were associated to both.Can you suggest how to get handle to the same?

The attributes are on the result of the Device: Get Node. Your workflow would likely have two of these nodes. One for the child device and another for the parent device.

@Brandon_Cannaday how were you able to get working section with deviceId and parentId, attributes etc in Virtual Button.The example payload is not editable and does not have those details. Do I just need to have another step and create the working attribute?

You need to attach a Device: Get Node to the Virtual Button. The Device: Get Node obtains details about a specific device or collection of devices.

Hi @Nishit_Saurabh,

In your Device: Get Node, make sure that you configure the Composite State To Include dropdown to either Include all attributes or Include the following attributes... and then select the appropriate attributes.