Using state messages to update multiple tags

@Zach_Jacobs awesome, thank you for the information!

You have two options here for bulk updating device tags. You can either:

  • Construct a loop within the workflow and utilize Device nodes
  • Build a schema and update using the API and PATCH

Let’s jump into the specifics of each.

Loop
To create this logic in a workflow you would need to use a Loop Node. Within the Loop Node, you would likely do a device lookup with the Device: Get Node in order to retrieve your devices matching your tag query. You would then use the Device: Update Node to update the tags for your devices.

Schema
The Losant API Node includes the Device PATCH resource which allows you to build a schema to update tags in bulk. The schema looks like so:

{
  "updateFields": {
    "tags": [
      {
        "key": "TagKey",
        "value": "TagValue"
      }
    ],
  },
  "deviceIds": [
    "575ecec57ae143cd83dc4a9f",
    "575ecec57ae143cd83dc4a9e",
    "575ecec57ae143cd83dc4a9a"
  ]
}

This would allow you to update in bulk, but you will have to create the logic to build the schema properly.

Let me know if I can assist further or if you have any additional questions.

Thanks!
Julia