You need to enable JavaScript to run this app.
导航
TagResources - 为资源打标签
最近更新时间:2025.05.07 20:27:49首次发布时间:2025.05.07 20:27:49
我的收藏
有用
有用
无用
无用

为资源打标签

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

TagResources

要执行的操作,取值:TagResources。

Version
String

2022-06-01

API的版本,取值:2022-06-01。

ResourceTrnList.N
Array of String

ResourceTrnList.1=trn:ecs:cn-beijing:1234567***:instance/instance_xxx&ResourceTrnList.2=trn:ecs:cn-beijing:1234567***:instance/instance_yyy

资源列表

Tags.N.Value
Array of String

Tag.1.Value=value1&Tag.2.Value=value2

标签值

Tags.N.Key
Array of String

Tag.1.Key=key1&Tag.2.Key=key2

标签键

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
FailedResources
Array of Object

[
{
"ResourceTrn": "trn:ecs:cn-beijing:1234567890:instance/instance_xxx",
"Code": "InternalError",
"Message": "The request processing has failed because of an internal error."
}
]

操作失败的资源列表

请求示例

POST /?Action=TagResources&Version=2022-06-01 HTTP/1.1
Host: open.volcengineapi.com
Content-Type: application/json; charset=UTF-8
X-Date: 20250507T114001Z
X-Content-Sha256: 287e874e******d653b44d21e
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20250507/cn-beijing/tag/request, SignedHeaders=host;x-content-sha256;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f

{
  "ResourceTrnList": ["trn:ecs:cn-beijing:123456***:instance/instance_xxx"],
  "Tags": [
    {
      "Key": "key1",
      "Value": "value1"
    }
  ]
}

返回示例

{
  "ResponseMetadata": {
    "RequestId": "20250507194032045171059123278D66",
    "Action": "TagResources",
    "Version": "2022-06-01",
    "Service": "tag",
    "Region": "cn-beijing"
  },
  "Result": {
    "FailedResources": [
      {
        "ResourceTrn": "trn:ecs:cn-beijing:1234567890:instance/instance_xxx",
        "Code": "InternelErr",
        "Message": "Service Internal Error, Please contact Admin."
      }
    ]
  }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
InvalidParameter.Tags.%d.Value

The specified parameter Tags.%d.Value is invalid.

无效的TagValue参数,其中%d,是Tags列表索引下标

400
InvalidParameter.Tags.%d.Key

The specified parameter Tags.%d.Key is invalid.

无效的TagKey参数。其中%d,是Tags列表索引下标

400
InvalidCredential

Invalid credential in 'Authorization', Pls check your authorization header.

无效的Credential

400
InvalidTrn

Trn '%s' is invalid because %s

无效的Trn参数。其中第一个%s,是具体的ResourceTrn;第二个%s,是无效的具体原因

400
InvalidParameter.ResourceTrnList

The specified parameter ResourceTrnList is invalid.

无效参数,ResourceTrnList

400
InvalidParameter.ResourceTrnList.%d

The specified parameter ResourceTrnList.%d is invalid.

无效参数:ResourceTrnList.%d。其中%d为ResourceTrnList列表的索引下标

400
InvalidParameter.AccountID

The specified parameter AccountID is invalid.

无效参数,AccountID

500
InternalError

The request processing has failed because of an internal error.

服务内部系统错误。往往是由服务内部组件异常、网络异常或服务自身bug导致,请及时联系相关管理员进行排查确认