Amazon Simple Storage Service
API Reference (API Version 2006-03-01)

GetObjectTagging

Returns the tag-set of an object. You send the GET request against the tagging subresource associated with the object.

To use this operation, you must have permission to perform the s3:GetObjectTagging action. By default, the GET operation returns information about current version of an object. For a versioned bucket, you can have multiple versions of an object in your bucket. To retrieve tags of any other version, use the versionId query parameter. You also need permission for the s3:GetObjectVersionTagging action.

By default, the bucket owner has this permission and can grant this permission to others.

For information about the Amazon S3 object tagging feature, see Object Tagging.

The following operation is related to GetObjectTagging:

Request Syntax

GET /{Key+}?tagging&VersionId=VersionId HTTP/1.1 Host: Bucket.s3.amazonaws.com

URI Request Parameters

The request requires the following URI parameters.

Bucket

The bucket name containing the object for which to get the tagging information.

Key

Object key for which to get the tagging information.

Length Constraints: Minimum length of 1.

versionId

The versionId of the object for which to get the tagging information.

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 x-amz-version-id: VersionId <?xml version="1.0" encoding="UTF-8"?> <GetObjectTaggingOutput> <TagSet> <Tag> <Key>string</Key> <Value>string</Value> </Tag> </TagSet> </GetObjectTaggingOutput>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

x-amz-version-id

The versionId of the object for which you got the tagging information.

The following data is returned in XML format by the service.

GetObjectTaggingOutput

Root level tag for the GetObjectTaggingOutput parameters.

Required: Yes

TagSet

Contains the tag set.

Type: Array of Tag data types

Examples

Sample Request

The following request returns the tag set of the specified object.

GET /example-object?tagging HTTP/1.1 Host: examplebucket.s3.amazonaws.com Date: Thu, 22 Sep 2016 21:33:08 GMT Authorization: authorization string

Sample Response

HTTP/1.1 200 OK Date: Thu, 22 Sep 2016 21:33:08 GMT Connection: close Server: AmazonS3 <?xml version="1.0" encoding="UTF-8"?> <Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <TagSet> <Tag> <Key>tag1</Key> <Value>val1</Value> </Tag> <Tag> <Key>tag2</Key> <Value>val2</Value> </Tag> </TagSet> </Tagging>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: