Purpose: This is an API sample code walkthrough for how to automate assigning a tag, or tags, to one or more assets (I cover the Postman method in this document).
Description: This example follows along with the community post on tagging examples (Asset Tagging API Examples ). Please feel free to post your comments/questions for follow up conversation.
Step 1: Get a list of host IDs
- Run a query for "All IP in subscription"
- If you do not have the "All IP in subscription" tag you can create one by either creating an asset group with all assets or by creating a tag with a QID that all assets have. Like an information gathered QID for host time. This should function well as a workaround once the tag has been completely assigned out, might talk a couple minutes to do if you selected the re-evaluate on rule save option.
- If there is another tag you can use replace string with that tag name and skip to step 2 below.
- Parse through the list to narrow it down to just the IPs needed, you will only need their HostIDs
Step 2: Add tag(s) to list of host IDs
- Now that you have a list of the asset IDs you want to add tags to you can follow along with the community post here: Asset Tagging API Examples