Vcenter Tagging Associations update

Vcenter Tagging Associations update

Updates the association of an object to multiple vSphere tags based on the Vcenter Tagging Associations TagSpec.operation specified. The Vcenter Tagging Associations TagSpec.operation on tags will be atomic. Partial completion is not allowed; in case of failure, the partially applied operation will be rolled back. If there exist any Cis Tagging Tag or Vcenter Tagging Associations TagCategoryNameInfo in Vcenter Tagging Associations TagSpec which are not valid, the partially applied operation will be rolled back. If one or more Vcenter Tagging Associations TagSpec in Vcenter Tagging Associations UpdateSpec.tag_spec_list is invalid, the partially applied operation will be rolled back and invalid entries will be returned in Vcenter Tagging Associations UpdateResult.errors with Vcenter Tagging Associations UpdateResult.success set to false.

This operation was added in vSphere API 9.1.0.0.

Request
URI
PATCH
https://{host}/api/vcenter/tagging/associations
COPY
Request Body

Specification of the tags to be associated with a resource object.

Vcenter Tagging Associations UpdateSpec of type(s) application/json
Required

Show optional properties

{
    "object": {},
    "tag_spec_list": [
        {
            "operation": "string"
        }
    ]
}
{
    "object": {
        "type": "string",
        "id": "string"
    },
    "tag_spec_list": [
        {
            "operation": "string",
            "tag_id": "string",
            "tag_category_name_info": {
                "tag_name": "string",
                "category_name": "string"
            }
        }
    ]
}
object
Required

Identifier of an object to attach or detach tags to. It must contain valid resource type and id.

This property was added in vSphere API 9.1.0.0.

array of object
tag_spec_list
Required

List of tag specifications to be applied with the object.

This property was added in vSphere API 9.1.0.0.

Authentication
This operation uses the following authentication methods.
Responses
200

Batch status

Returns Vcenter Tagging Associations UpdateResult of type(s) application/json
{
    "success": false,
    "results": [
        {
            "operation": "string",
            "tag": "string",
            "tag_category_name_info": {
                "tag_name": "string",
                "category_name": "string"
            }
        }
    ],
    "errors": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": {
                        "id": "string",
                        "params": {
                            "params": "Vapi Std LocalizationParam Object"
                        }
                    },
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ]
}
boolean
success
Required

Indicates whether all requested changes were successfully applied to the resource object.

Sets to true if all Vcenter Tagging Associations TagSpec.operation in Vcenter Tagging Associations UpdateSpec.tag_spec_list completed without errors. Sets to false if one or more Vcenter Tagging Associations TagSpec.operation in Vcenter Tagging Associations UpdateSpec.tag_spec_list failed. See the Vcenter Tagging Associations UpdateResult.errors for details.

This property was added in vSphere API 9.1.0.0.

array of object
results
Optional

Represents a list of results from the Vcenter Tagging Associations UpdateSpec.tag_spec_list that were attached or detached. The property does not specify which operations succeeded or failed, but rather which tags were newly added or removed as part of this call. The property is populated only when Vcenter Tagging Associations UpdateResult.success is set to true.

If Vcenter Tagging Associations UpdateResult.success is true and the property contains all the items from Vcenter Tagging Associations UpdateSpec.tag_spec_list, it means that all the requested attach/detach calls were successful and all the attaches/ detaches were performed as part of this call. For example, Suppose no tags are currently attached to the resource. If the call attempts to attach four tags T1, T2, T3 and T4 then this property will contain T1, T2, T3 and T4 as all of them were newly attached. Similarly, suppose all four tags T1, T2, T3 and T4 are currently not attached and this call attempts to detach T1, T2, T3, T4 then this field will only contain T1, T2, T3, T4.

If Vcenter Tagging Associations UpdateResult.success is true and if the property contains only a subset of items from Vcenter Tagging Associations UpdateSpec.tag_spec_list,it means that all requested tags were correctly attached to/ detached from the object. The property indicates which tags were actually attached/ detached as a result of this call. For example, Suppose tags T1, T2 are already attached to the resource. If this call attempts to attach two new tags, say T3 and T4, then this property will only contain T3 and T4, since they were the ones actually attached as part of this call. Similarly, if T1 and T2 are not attached, and this call attempts to detach T1, T2, T3, T4 then this field will only contain T3 and T4, as they were the ones actually detached during this call.

If Vcenter Tagging Associations UpdateResult.success is false, this property is unset. Any item present in the input Vcenter Tagging Associations UpdateSpec.tag_spec_list but missing from the property means that the tag was already attached or detached. It does not indicate a failure of the operation.

This property was added in vSphere API 9.1.0.0.

If missing or null, no tags were applied during this PATCH /vcenter/tagging/associations call.

array of object
errors
Optional

List of error messages specifying the tags for which the operation failed, if any errors occurred during update processing. This property is populated only when Vcenter Tagging Associations UpdateResult.success is set to false.

This property was added in vSphere API 9.1.0.0.

If missing or null, the PATCH /vcenter/tagging/associations operation completes successfully and no errors occurred.


400

if the Vcenter Tagging Associations UpdateSpec has empty list of Vcenter Tagging Associations TagSpec or invalid/empty Vcenter Tagging Associations TagSpec.operation, Vcenter Tagging Associations TagSpec.tag_id and Vcenter Tagging Associations TagSpec.tag_category_name_info

Returns Vapi Std Errors InvalidArgument of type(s) application/json
This response body class contains all of the following: Vapi Std Errors Error
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": "Vapi Std NestedLocalizableMessage Object",
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}

401

if the user can not be authenticated.

Returns Vapi Std Errors Unauthenticated of type(s) application/json
This response body class contains all of the following: Vapi Std Errors Error
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": "Vapi Std NestedLocalizableMessage Object",
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string",
    "challenge": "string"
}
string
challenge
Optional

Indicates the authentication challenges applicable to the target API provider. It can be used by a client to discover the correct authentication scheme to use. The exact syntax of the value is defined by the specific provider, the protocol and authentication schemes used.

For example, a provider using REST may adhere to the WWW-Authenticate HTTP header specification, RFC7235, section 4.1. In this case an example challenge value may be: SIGN realm="27da1358-2ba4-11e9-b210-d663bd873d93",sts="http://vcenter/sso?vsphere.local", Basic realm="vCenter"

This property was added in vSphere API 7.0.0.0.

This property is optional because it was added in a newer version than its parent node.


403

if the user does not have InventoryService.Tagging.ObjectAttachable on the Vcenter Tagging Associations UpdateSpec.object and InventoryService.Tagging.AttachTag on the tags specified in the Vcenter Tagging Associations TagSpec.

Returns Vapi Std Errors Unauthorized of type(s) application/json
This response body class contains all of the following: Vapi Std Errors Error
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": "Vapi Std NestedLocalizableMessage Object",
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string",
    "challenge": "string"
}
string
challenge
Optional

Indicates the authentication challenges applicable to the target API provider. It can be used by a client to discover the correct authentication scheme to use. The exact syntax of the value is defined by the specific provider, the protocol and authentication schemes used.

For example, a provider using REST may adhere to the WWW-Authenticate HTTP header specification, RFC7235, section 4.1. In this case an example challenge value may be: SIGN realm="27da158-2ba4-11e9-b",sts="http://vcenter/sso?vsphere.local", Basic realm="vCenter"

This property was added in vSphere API 9.1.0.0.

This property is optional because it was added in a newer version than its parent node.


404

if the resource object is not registered on the vCenter Server

Returns Vapi Std Errors NotFound of type(s) application/json
This response body class contains all of the following: Vapi Std Errors Error
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": "Vapi Std NestedLocalizableMessage Object",
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}

500

if there is generic error.

Returns Vapi Std Errors Error of type(s) application/json
{
    "messages": [
        {
            "id": "string",
            "default_message": "string",
            "args": [
                "string"
            ],
            "params": {
                "params": {
                    "s": "string",
                    "dt": "string",
                    "i": 0,
                    "d": "number",
                    "l": "Vapi Std NestedLocalizableMessage Object",
                    "format": "string",
                    "precision": 0
                }
            },
            "localized": "string"
        }
    ],
    "data": {},
    "error_type": "string"
}
array of object
messages
Required

Stack of one or more localizable messages for human error consumers.

The message at the top of the stack (first in the list) describes the error from the perspective of the operation the client invoked.

Each subsequent message in the stack describes the "cause" of the prior message.

object
data
Optional

Data to facilitate clients responding to the operation reporting a standard error to indicating that it was unable to complete successfully.

Operations may provide data that clients can use when responding to errors. Since the data that clients need may be specific to the context of the operation reporting the error, different operations that report the same error may provide different data in the error. The documentation for each each operation will describe what, if any, data it provides for each error it reports.

The Vapi Std Errors ArgumentLocations, Vapi Std Errors FileLocations, and Vapi Std Errors TransientIndication schemas are intended as possible values for this property. Vapi Std DynamicID may also be useful as a value for this property (although that is not its primary purpose). Some resources may provide their own specific schemas for use as the value of this property when reporting errors from their operations.

Some operations will not set this property when reporting errors.

string
error_type
Required

Discriminator field to help API consumers identify the structure type.

For more information see: Vapi Std Errors Error Type.

This property was added in vSphere API 6.7.2.

Can be missing or null for compatibility with preceding implementations.


Code Samples
COPY
                    curl -X PATCH -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"object":"{}","tag_spec_list":["object"]}'