Feature Overview
This API (GET Object tagging) is used to query the existing tags of an object.
If a sub-account needs to call this API (
GET Object tagging), ensure that the root account has authorized it to do so.Versioning
If you have enabled versioning for the bucket and want to query the tags of an object of a specified version, include the
VersionId parameter in the request.Requests
Sample Request
GET /<ObjectKey>?tagging&VersionId=VersionId HTTP 1.1Host:<BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth String
Note
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com, where <BucketName-APPID> is the bucket name with the APPID suffix, such as examplebucket-1250000000. You can refer to the Bucket Overview > Basic Information and Bucket Overview > Bucket Naming Convention documentation. <Region> represents the available regions for COS, which can be found in the Regions and Access Domain Names documentation.
Authorization: Auth String (For more information, see Request Signature.)
Request Parameters
Name | Description | Local Disk Types | Required |
versionId | Version ID of the object (if versioning is enabled). If this parameter is not specified, the latest version will be queried. | string | Not required |
Request Header
Request Body
The request body of this request is empty.
Response
Response Header
Response Body
The following describes the nodes of the response body returned by this request:
Node Name (Keyword) | Parent Node | Description | Local Disk Types | Required |
Tagging | - | Tagging configuration | Container | Required |
TagSet | Tagging | Tagging configuration | Container | Required |
Tag | Tagging.TagSet | A single tag. Up to 10 tags are supported. | Containers | Required |
Key | Tagging.TagSet.Tag | Tag key, with a length less than 128 bytes, supports English letters, numbers, spaces, plus signs, minus signs, underscores, equal signs, periods, colons, and slashes. | String | Required |
Value | Tagging.TagSet.Tag | Tag value, with a length less than 256 bytes, supports English letters, numbers, spaces, plus signs, minus signs, underscores, equal signs, periods, colons, and slashes. | String | Required |
Error Codes
Examples
Requests
The following example queries the tags of the
exampleobject.txt object in the examplebucket-1250000000 bucket. COS parses the request and returns the {age:18} and {name:xiaoming} tags.GET /exampleobject.txt?tagging HTTP/1.1User-Agent: curl/7.29.0Accept: */*Host: examplebucket-1250000000.cos.ap-beijing.myqcloud.comAuthorization: Auth StringContent-Md5: MD5 StringContent-Length: 127Content-Type: application/xml
Response
HTTP/1.1 200 OKContent-Type: application/xmlConnection: closeDate: Fri, 19 Jan 2020 11:40:22 GMTServer: tencent-cos<Tagging><TagSet><Tag><Key>age</Key><Value>18</Value></Tag><Tag><Key>name</Key><Value>xiaoming</Value></Tag></TagSet></Tagging>