Retrieves the tags of an object in a bucket.
Usage notes
By default, an Alibaba Cloud account has permission to query object tags. A RAM user or Security Token Service (STS) credential requires the
oss:GetObjectTaggingpermission. For details, see Attach a custom policy to a RAM user.By default, the command retrieves the tags of the current version of an object. Specify
--version-idto query a specific version.
Command syntax
ossutil api get-object-tagging --bucket <value> --key <value>
[--version-id <value>]
[flags]Parameters without brackets are required.
Parameters in brackets
[ ]are optional.
The get-object-tagging command maps to the GetObjectTagging API operation. For supported global flags, see Command-line options.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
--bucket | string | Yes | Bucket name. |
--key | string | Yes | Full path of the object, for example, dir/example.txt. |
--version-id | string | No | Version ID of the object. If omitted, the current version is queried. |
Examples
Query the tags of an object:
ossutil api get-object-tagging --bucket examplebucket --key exampleobjectQuery the tags and display the output in JSON format:
ossutil api get-object-tagging --bucket examplebucket --key exampleobject --output-format jsonQuery the tags and display the output in YAML format:
ossutil api get-object-tagging --bucket examplebucket --key exampleobject --output-format yaml