Assigning tags to VM and service template using REST API

Hi,

I am trying to assign tags to VM and service template through REST API

POST /api/vms/320/tags
{
  "action" : "assign",
  "resources" : [
    { "category" : "department", "name" : "TOF" }

  ]
}

That doesn’t seems to work and I am always getting

"results": [
        {
            "success": false,
            "message": "Assigning Tag: category:'department' name:'TOF' - FAILED. Tag name 'TOF' not found  in region 1",
            "href": "https://10.17.0.8/api/vms/1000000002022",
            "tag_category": "department",
            "tag_name": "TOF"
        }
    ]

What is region 1? Do I need to have tags baked in to the VM or service template before I can assign the value?

Thanks

Tag names are always lower case alphanumeric, maybe “TOF” is the description? Try “tof” (if that’s the tag name).

pemcg

I think I know what’s the issue. It looks like I need to create the tag resource first before I can assign to anything. Is there a REST API for doing that?

Sure, here’s the doc:

Perfect, thanks!