Tag a device through the REST API
Tags can help you classify devices that share a common characteristic from among potentially hundreds of discovered devices on your network.
You might want to tag devices by their role on your network, such as the devices that make up your development and production servers. For example, if you are running multiple AWS instances in your environment, it is critical to size them for their workload. An undersized instance can result in poor performance; an oversized instance is needlessly costly. If you tag your AWS instances, you can easily set up device groups by instance size, and then create a dashboard to monitor usage and performance metrics.
In this guide, you will learn how create a tag, find the device you want to tag, and then add the tag to the device. An example script is provided at the end, which adds a given device tag to all IP addresses read from a CSV file.
Before you begin
- For sensors and ECA VMs, you must have a valid API key to make changes through the REST API and complete the procedures below. (See Generate an API key.)
- For Reveal(x) 360, you must have valid REST API credentials to make changes through the REST API and complete the procedures below. (See Create REST API credentials.)
Create a tag
If you already have a tag on the system, you can skip this step. The example script at the bottom of this guide will check for a tag and create a new tag only if necessary.
Retrieve devices that match your criteria
In this step you will search for the devices that you want to tag and note the device ID. You must have the device ID before you can tag devices.
Assign the tag to a device
In this step, you will assign a tag to a device by the device ID you found in the previous step.
- Scroll down the page and click Tag to display tag operations.
- Click POST /tags/{id}/devices/{child-id}.
- Click Try it out.
- In the child-id field, type the ID of the device you want to tag.
- In the id field, type the ID of the tag you want to assign.
- Click Send Request to assign the tag to the device.
Tip: | After you click Send Request, you can click the tabs to view scripts for the operation in Curl, Python 2.7, or Ruby. |
Thank you for your feedback. Can we contact you to ask follow up questions?