REST API - attach_tag_to_multiple_objects

cis tagging tag association: attach tag to multiple objects

Attaches the given tag to the input objects. If a tag is already attached to the object, then the individual operation is a no-op and an error will not be added to cis.tagging.tag_association.batch_result.error_messages. To invoke this operation, you need the attach tag privilege on the tag and the read privilege on each object. This operation was added in vSphere API 6.5.

Request:

HTTP request

POST https://{server}/rest/com/vmware/cis/tagging/tag-association/id:{tag_id}?~action=attach-tag-to-multiple-objects

Path Parameters

Name Type Description
Required
tag_id string The identifier of the input tag.

Request Body Structure:

{
    "object_ids"[
        {
            "id""obj-103",
            "type""string"
        },
        {
            "id""obj-103",
            "type""string"
        }
    ]
}

Request Body Parameters:

Name Type Description
bold = required
object_ids dynamic_ID[] The identifiers of the input objects.
object_ids[].type string The type of resource being identified (for example com.acme.Person).

Services that contain operations for creating and deleting resources typically contain a constant specifying the resource type for the resources being created and deleted. The API metamodel metadata services include a service that allows retrieving all the known resource types.

object_ids[].id string The identifier for a resource whose type is specified by vapi.std.dynamic_ID.type.

When clients pass a value of this structure as a parameter, the field type must contain the actual resource type. When operations return a value of this structure as a result, the field type will contain the actual resource type.

Response:

HTTP Status Code: 200

Representation:

{
    "value"{
        "success"true,
        "error_messages"[
            {
                "args"[
                    "string",
                    "string"
                ],
                "default_message""string",
                "localized""string",
                "id""string",
                "params"[
                    {
                        "value"{
                            "dt""2015-01-01T22:13:05.651Z",
                            "s""string",
                            "d"1.5,
                            "precision"1,
                            "format""SHORT_DATE",
                            "i"1,
                            "l"{
                                "id""string",
                                "params"[
                                    {
                                        "value"{
                                            "dt""2015-01-01T22:13:05.651Z",
                                            "s""string",
                                            "d"1.5,
                                            "precision"1,
                                            "format""SHORT_DATE",
                                            "i"1,
                                            "l"{
                                                "id""string",
                                                "params"[
                                                    {
                                                        "key""string"
                                                    }
                                                ]
                                            }
                                        },
                                        "key""string"
                                    }
                                ]
                            }
                        },
                        "key""string"
                    }
                ]
            },
            {
                "args"[
                    "string",
                    "string"
                ],
                "default_message""string",
                "localized""string",
                "id""string",
                "params"[
                    {
                        "value"{
                            "dt""2015-01-01T22:13:05.651Z",
                            "s""string",
                            "d"1.5,
                            "precision"1,
                            "format""SHORT_DATE",
                            "i"1,
                            "l"{
                                "id""string",
                                "params"[
                                    {
                                        "value"{
                                            "dt""2015-01-01T22:13:05.651Z",
                                            "s""string",
                                            "d"1.5,
                                            "precision"1,
                                            "format""SHORT_DATE",
                                            "i"1,
                                            "l"{
                                                "id""string",
                                                "params"[
                                                    {
                                                        "key""string"
                                                    }
                                                ]
                                            }
                                        },
                                        "key""string"
                                    }
                                ]
                            }
                        },
                        "key""string"
                    }
                ]
            }
        ]
    }
}

Response Type:

Name Type Description
bold = required
value batch_result The outcome of the batch operation and the array of error messages (cis.tagging.tag_association.batch_result.error_messages) describing attachment failures.
value.success boolean This is true if the batch operation completed without any errors. Otherwise it is false and all or some operations have failed. This attribute was added in vSphere API 6.5.

value.error_messages localizable_message[] The array of error messages. This attribute was added in vSphere API 6.5.

value.error_messages[].id string Unique identifier of the localizable string or message template.

This identifier is typically used to retrieve a locale-specific string or message template from a message catalog.

value.error_messages[].default_message string The value of this localizable string or message template in the en_US (English) locale. If vapi.std.localizable_message.id refers to a message template, the default message will contain the substituted arguments. This value can be used by clients that do not need to display strings and messages in the native language of the user. It could also be used as a fallback if a client is unable to access the appropriate message catalog.

value.error_messages[].args string[] Positional arguments to be substituted into the message template. This list will be empty if the message uses named arguments or has no arguments.

Errors:

HTTP Status Code Type Description
404 not_found if the tag for the given tag_id does not exist in the system.
403 unauthorized if you do not have the attach tag privilege on the tag.
401 unauthenticated if the user can not be authenticated.