Question

how to use the REST API to bulk update client entity tags

  • 7 October 2022
  • 5 replies
  • 174 views

Badge +1

We want to add custom tags on each backup object via Python automation.

Can you please provide guideline on how to use the REST API to bulk update client entity tags


5 replies

Userlevel 7
Badge +23

Hi @LizY , thanks for the post!

Here's the PUT tag API:

https://api.commvault.com/#ff151454-c056-4931-99d9-a63ce3eefe3f

Let me know if that helps!

Badge +1

Hi Mike,

Thanks for your response.
From this example below, which virtual machine/hypervisor/object storage/db instance is this tag applying to? 

 

curl --location --request PUT 'http://WebConsoleHostName/webconsole/api/Tags' \
--header 'Accept: application/json' \
--header 'Authtoken: QSDK token would be auto set after POST Login is called.' \
--header 'Content-Type: application/json' \
--data-raw '{
"entityTag": [
{
"entityType": 3,
"entityId": 9,
"tag": [
{
"name": "Brand",
"value": "Apple"
}
]
},
{
"entityType": 3,
"entityId": 8,
"tag": [
{
"id": 452,
"name": "Brand",
"value": "Google"
}
]
}
]
}'
Userlevel 7
Badge +23

The entity types are listed a bit higher in that doc (the page is one long document):

https://api.commvault.com/#a9243cf8-2826-4431-9ff2-c8e768edd89b

 

You should be able to use this request to get all of the details which will in turn give you all entity ids:

https://api.commvault.com/#9a2e42f5-d395-4381-9f23-7339737ecd68

the example doesn’t really translate into an actual environment, you’d have to run it in your environment so the results make sense 🤓

Badge +1

Hi Mike,

Thanks for your input.
Once the entity has been tagged, how to make the custom tags visible on the backup job report so that it is more meaningful for end user to read?
e.g.
For each backup on the report, this backup is for an Azure VM, resource group is x, subscription id is y, job status is completed.

Userlevel 7
Badge +23

@LizY , you can add tags to a report via Report builder:

https://documentation.commvault.com/2022e/essential/145636_adding_ui_tags_to_reports.html

You can create and customize as needed.

Reply