You need to enable JavaScript to run this app.
导航

TagResources

最近更新时间2024.02.29 14:48:21

首次发布时间2023.08.08 21:31:48

API 说明

API 名称:TagResources 。
API 域名:open.volcengineapi.com 。
API 描述:调用 TagResources 接口,为资源添加用户标签。

说明

  • 为同一个资源重复添加相同标签键的标签,则后面的标签值会自动覆盖前面的。

  • 每个资源最多可添加50个用户标签,每次调用该接口最多可添加20个用户标签。

  • a.N.b类型的参数中,“N”表示标签信息的序号,需按照数字顺序从1开始填写,取值范围为1~20。多个标签之间使用&分隔。

使用限制

节流限制:每秒最多提交 5 个 API 请求。

快速调试

URI 参数

在使用该部分 API 提交请求时必须包含以下 URI 参数。

除了 URI 参数,该 API 请求还需要包含签名参数。关于更多签名参数的信息,参见公共请求参数 。

名称类型是否必选格式说明
Action
string
[a-zA-Z]+
API 名称,如 TagResources 。
VersionstringYYYY-MM-DDAPI 版本信息。该参数的取值是 2020-04-01 。

请求正文

在使用该 API 提交请求时,请求正文中可以包含的参数如下。

参数类型是否必选参数说明示例值
ResourceTypeString资源的类型,取值为 loadbalancer。loadbalancer
ResourceIds.NList of String资源的ID。参数 - N:表示资源 ID的序号,单次调用数量上限50个。多个资源 ID之间使用 & 分隔。ResourceIds.1=alb-273sdsdsxxxxxp8u2j****&ResourceIds.2=alb-2fe6fszjgeznk5oxruv0u****
TagsArray标签列表,单次操作数量上限20个,具体参见下表 Tags-

Tags

参数类型是否必选参数说明示例值

Tags.N.Key

String

用户标签的标签键。规则如下:

  • 长度限制为1~128个字符。

  • 大小写敏感,不能以volc:的任意大小写组合开头。

  • 不能以空格开头或结尾。

  • 允许包含各国语言文字、数字、空格()、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、减号(-)和@。

  • 同一资源的标签键不允许重复。

Tags.1.Key=k1&Tags.2.Key=k2

Tags.N.Value

String

用户标签的标签值。具体规则如下:

  • 长度限制为0~256个字符。

  • 大小写敏感,不能以空格开头或结尾。

  • 允许包含各国语言文字、数字、空格()、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、减号(-)和@。

  • 如果传入该参数,则必须先传入Tags.N.Key。

Tags.1.Value=v1&Tags.2.Value=v2

响应正文

参数类型参数说明示例值
RequestIdString请求ID。2021062415303301022514515207C4****

请求示例

GET /?Action=TagResources&ResourceType=loadbalancer&ResourceIds.1=alb-r1rvlqgt58u83dvb46c1j2fi&Tags.1.Key=yxl12&Tags.1.Value=yxl12&Tags.2.Key=yxl13&Tags.2.Value=yxl13&Version=2020-04-01&AccountId=2100052283" -H "X-Top-Account-Id: 2100052283"

响应示例

{
    "ResponseMetadata":{
        "RequestId":"a295610f-5602-4ba8-ab73-84158c7b5dd7",
        "Action":"TagResources",
        "Version":"2020-04-01"
    },
    "Result":{
        "RequestId":"a295610f-5602-4ba8-ab73-84158c7b5dd7"
    }
}

错误码

如果响应正文包含 Error 字段,则表示 API 请求失败。此处仅展示当前 API 的错误码,更多错误码请参见公共错误码

HTTP Code错误码错误信息错误描述

400

LimitExceed.Tag

You've reached the limit on the number of tags that you can operate at a time.

已达到单次可操作的标签的数量上限。

400InvalidResourceType.MalformedThe specified ResourceType is malformed.指定的 ResourceType 参数格式不合法。

400

LimitExceed.Resource

You've reached the limit on the number of resources that you can operate at a time.

已达到单次可操作的资源的数量上限。

400

MissingParameter

The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, 'ResourceIds'.

该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如: ResourceIds。

400

MissingParameter

The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, 'Tags'.

该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如: Tags。

400InvalidIndexOrder.MalformedThe specified index order is malformed.指定的索引顺序参数格式不合法。
400InvalidTags.Key.MalformedThe specified Tags.Key is malformed.指定的 Tags.Key 参数格式不合法。
400InvalidTags.Value.MalformedThe specified Tags.Value is malformed.指定的 Tags.Value 参数格式不合法。
400InvalidTags.Key.DuplicatedThe specified Tags.Key is duplicated.指定的 Tags.Key 重复。
404InvalidResource.NotFoundThe specified Resource does not exist.指定的资源不存在。