ListTagsForResource
Lists tags for the specified resource.
Request Syntax
{
"ResourceARN": "string
"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- ResourceARN
-
The Amazon Resource Name (ARN) of the resource that you want to retrieve tags for.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1011.
Required: Yes
Response Syntax
{
"Tags": [
{
"Key": "string",
"Value": "string"
}
]
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
Errors
For information about the errors that are common to all actions, see Common Errors.
- InvalidInput
-
One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.
HTTP Status Code: 400
- ResourceNotFoundException
-
The operation can't be completed because the resource was not found.
HTTP Status Code: 400
Examples
ListTagsForResource Example
This example illustrates one usage of ListTagsForResource.
Sample Request
POST / HTTP/1.1
Host: servicediscovery.us-east-1.amazonaws.com
Accept-Encoding: identity
X-Amz-Target: Route53AutoNaming_v20170314.ListTagsForResource
Content-Type: application/x-amz-json-1.1
X-Amz-Date: 20200521T193322Z
X-Amz-Security-Token: [security-token]
Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20200521/us-east-1/servicediscovery/aws4_request,
SignedHeaders=content-type;host;x-amz-date;x-amz-security-token;x-amz-target,
Signature=[calculated-signature]
Content-Length: [number of characters in the JSON string]
{
"ResourceARN": "arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-ylexjili4cdxy3xm"
}
Sample Response
HTTP/1.1 200
Content-Type: application/x-amz-json-1.1
Date: Thu, 21 May 2020 19:33:22 GMT
x-amzn-RequestId: [request-id]
Content-Length: [number of characters in the JSON string]
Connection: keep-alive
{
"Tags": [{
"Key": "Project",
"Value": "Zeta"
}, {
"Key": "Department",
"Value": "Engineering"
}]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: