tencent cloud

文档反馈

TagResources

最后更新时间:2024-03-20 15:31:06

    1. API Description

    Domain name for API request: tag.tencentcloudapi.com.

    This API is used to create and bind a tag uniformly to multiple specified resources of multiple Tencent Cloud services.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: TagResources.
    Version Yes String Common Params. The value used for this API: 2018-08-13.
    Region No String Common Params. This parameter is not required for this API.
    ResourceList.N Yes Array of String Cloud resource to be bound, represented in the standard six-segment resource format. For the correct format, see Resource Description Method.
    Value range of N: 0-9.
    Tags.N Yes Array of Tag Tag key and value.
    If multiple tags are specified, all such tags will be created and bound to the specified resources.
    For each resource, each tag key can have only one value. If you try to add an existing tag key, the corresponding tag value will be updated to the new value.
    Non-existent tags will be automatically created.
    Value range of N: 0-9

    3. Output Parameters

    Parameter Name Type Description
    FailedResources Array of FailedResource Information of failed resources.
    When tag creating and binding succeeds, the returned FailedResources will be empty.
    When tag creating and binding partially or completely fails, the returned FailedResources will display the details of failed resources.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Binding tags to resources

    This example shows you how to bind tags to resources

    Input Example

    POST / HTTP/1.1
    Host: tag.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: TagResources
    <Common request parameters>
    
    {
        "ResourceList": [
            "qcs::cvm:ap-beijing:uin/10000055****:instance/ins-****",
            "qcs::cvm:ap-shanghai:uin/10000055****:volme/volme-****"
        ],
        "Tags": [
            {
                "TagKey": "11",
                "TagValue": "11"
            },
            {
                "TagKey": "22",
                "TagValue": "22"
            }
        ]
    }
    

    Output Example

    {
        "Response": {
            "FailedResources": [],
            "RequestId": "a4c9f540-b04e-47c4-a267-4a398b70d2f5"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    AuthFailure.UnauthorizedOperation CAM authentication failed.
    FailedOperation The operation failed.
    FailedOperation.PolicyEnforcedInvalid
    FailedOperation.ResourceTagProcessing The resource tag is being processed.
    InvalidParameter Incorrect parameter.
    InvalidParameter.ReservedTagKey System reserved tag keys qcloud, tencent and project cannot be created.
    InvalidParameter.Tag Tag parameter error.
    InvalidParameter.UnsupportedService The current business does not support tag operations.
    InvalidParameterValue.ResourceDescriptionError Resource description error.
    InvalidParameterValue.TagKeyCharacterIllegal Tag key contains illegal characters.
    InvalidParameterValue.TagKeyDuplicate There are duplicate TagKeys in TagList.
    InvalidParameterValue.TagKeyEmpty Tag key cannot be empty.
    InvalidParameterValue.TagKeyLengthExceeded Tag key length exceeds limit.
    InvalidParameterValue.TagValueCharacterIllegal Tag value contains illegal characters.
    InvalidParameterValue.TagValueEmpty The tag value cannot be empty.
    InvalidParameterValue.TagValueLengthExceeded Tag value length exceeds limit.
    LimitExceeded.ResourceNumPerRequest The number of resources requested at a time reaches the upper limit.
    LimitExceeded.TagNumPerRequest The number of tags in a single request exceeds the limit.
    LimitExceeded.TagValue Each tag key can have up to 1,000 values.