VMware Cloud Community
dbis7575
Enthusiast
Enthusiast
Jump to solution

vRA8 update Tags with API call

I am trying to update Tags on a machine that is part of a deployment using the following API call:

/deployment/api/deployments/{depId}/resources/{resourceId}/requests

With the following body:

{
 
"actionId": "Cloud.vSphere.Machine.Update.Tags",
 
"inputs": {

                         "key":"testkey"

                         "value":"testvalue"  

                 },
 
"reason": "testing"
}

When I run this the response shows the task is not completed and pending, when looking at the GUI it completes without updating the tags.

I expect the issue is with the inputs being provided, I have tried different variations most of them that result in an error. If I place a tag on the machine prior to running this API call, the tag gets removed (assume I have to read them in and pass them back with the update call).

If anyone has this functional, please provide the correct syntax.

Reply
0 Kudos
1 Solution

Accepted Solutions
stevedrummond
Hot Shot
Hot Shot
Jump to solution

Your input needs to be an array of tags including the existing tags you want to keep.

"inputs": {

     "tags": [

          { "key":"myTag", "value": "myValue" },

          { "key":"anotherTag", "value":"anotherValue" }

     ]

}

View solution in original post

Reply
0 Kudos
5 Replies
stevedrummond
Hot Shot
Hot Shot
Jump to solution

Your input needs to be an array of tags including the existing tags you want to keep.

"inputs": {

     "tags": [

          { "key":"myTag", "value": "myValue" },

          { "key":"anotherTag", "value":"anotherValue" }

     ]

}

Reply
0 Kudos
dbis7575
Enthusiast
Enthusiast
Jump to solution

Steve,


That did it, thank you very much.

Reply
0 Kudos
KDUGanesh
Contributor
Contributor
Jump to solution

where to update the code, is it in cloud template, need more details

Reply
0 Kudos
gregd90
VMware Employee
VMware Employee
Jump to solution

This is an API call from Postman etc. to the vRA API. It's executed against a machine in a deployment. Consider it as a Day 2 operation on the machine.

The Cloud Template contains the constraint tags read at request phase, in this scenario they are not updated.

Regards,

Greg, VMware

vinaykumar561
Contributor
Contributor
Jump to solution

Hi Steve,

I have similar task to do, but in this case API call is triggering day2 with actionID but in my case I don't have "Update Tags" day2 resource action. I need actual workflow code to update tags. could you please help me with that?.

Many Thanks in Advance

Tags (1)
Reply
0 Kudos