PUT Object tagging
), ensure that the root account has authorized it to do so.VersionId
parameter in the request.PUT /<ObjectKey>?tagging&VersionId=VersionId HTTP 1.1Host:<BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth String
examplebucket-1250000000
(see Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Conventions), and <Region> is a COS region (see Regions and Access Endpoints).Parameter | Description | Type | Required |
versionId | Version ID of the object (if versioning is enabled). If this parameter is not specified, tags will be added to the latest version of the object. | string | No |
<?xml version="1.0" encoding="UTF-8" ?><Tagging><TagSet><Tag><Key>string</Key><Value>string</Value></Tag></TagSet></Tagging>
Node Name (Keyword) | Parent Node | Description | Type | Required |
Tagging | None | Tagging configuration | Container | Yes |
TagSet | Tagging | Tag set | Container | Yes |
Tag | Tagging.TagSet | A single tag. Up to 10 tags are supported. | Containers | Yes |
Key | Tagging.TagSet.Tag | Tag key, which can be up to 128 characters. A tag key can contain letters, digits, spaces, plus signs (+), minus signs (−), underscores (_), equals signs (=), dots (.), colons (:), and slashes (/). | String | Yes |
Value | Tagging.TagSet.Tag | Tag value, which can be up to 256 characters. A tag value can contain letters, digits, spaces, plus signs (+), minus signs (−), underscores (_), equals signs (=), dots (.), colons (:), and slashes (/). | String | Yes |
{age:18}
and {name:xiaoming}
tags to the exampleobject.txt
object in the examplebucket-1250000000
bucket. COS configures the tags and returns 200 (success).PUT /exampleobject.txt?tagging HTTP/1.1User-Agent: curl/7.29.0Accept: */*Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.comAuthorization: Auth StringContent-Length: 127Content-MD5:MD5 StringContent-Type: application/xml<Tagging><TagSet><Tag><Key>age</Key><Value>18</Value></Tag><Tag><Key>name</Key><Value>xiaoming</Value></Tag></TagSet></Tagging>
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 0Connection: keep-aliveDate: Fri, 19 Jan 2020 11:40:22 GMTServer: tencent-cosx-cos-request-id: NWE2MWQ5MjZfMTBhYzM1MGFfMTA5ODVfMTVj****
Was this page helpful?