Tech Tip:  Adding Tags to a Device Using the External API

Discussion created by voged01 Employee on Feb 16, 2018

A customer recently opened a ticket because he was having a problem using SOAPUI to add tags to a device.  I opened the API Doc from the GUI, under settings, as it is a really good tool for testing API commands. It lets you run commands, in addition to documenting them. In order to add tags you must use /api.php/v1/devices.json/{id}/tags.  You can see that this requires the device id.  In order to get this use /api.php/v1/devices.json to get the list of all devices.  You will see the device id when you find the device to which you want to add the tags.  You can also do this programmatically, by having your program parse the list to find the desired device.  When you add the tag use this syntax:  ["yourtag"]. You can specify multiple tags by separating the strings with commas, like this:  ["yourtag1","yourtag2"].  This also worked from SOAPUI, once the request was properly configured.