Create instance and assign tags

I have an instance type configured with inputs that are entered on the “add instance” wizard form, and used to tag the instance. The inputs are marked “export as tag” so they are exported to VMware vCenter and assigned to the VM.

If I use the API to create an instance, I would like to assign tags to the instance when it is created and have them exported to vCenter (as described above). I have added “tags”:[{}] containing name value pairs to the JSON body but they don’t get added to the instance nor do they get assigned to the VM in vCenter.

Here is an example:


The request is accepted by the API and the instance is provisioned, but the tags do not get assigned. I am using the same instance type and the name of the tags matches the “Field Name” of the tags. I have also tried using the name of the input as well.

Have I missed something? What am I doing wrong?

If you want to add the inputs which have export as tag checked, the payload should look like this,

  "config": {
    "customOptions": {
      "tag1": "abcd"

Where tag1 is the Field Name of that input and abcd is the value.

Thanks very much for that. It has worked. :slightly_smiling_face:

1 Like