| Did this page help you? Yes No Tell us about it... |
The GetQueueAttributes action returns one or all
attributes of a queue.
Calling GetQueueAttributes with the AttributeName set to All returns values for each
API version as indicated in the following table.
| Attribute | 2008-01-01 | 2009-02-01 | 2011-10-01 |
|---|---|---|---|
VisibilityTimeout |
![]() |
![]() |
![]() |
ApproximateNumberOfMessages |
![]() |
![]() |
![]() |
ApproximateNumberOfMessagesNotVisible |
![]() |
![]() | |
CreatedTimestamp |
![]() |
![]() | |
LastModifiedTimestamp |
![]() |
![]() | |
QueueArn |
![]() |
![]() | |
MaximumMessageSize |
![]() |
![]() | |
MessageRetentionPeriod |
![]() |
![]() | |
Policy |
![]() |
![]() | |
DelaySeconds |
![]() | ||
ApproximateNumberOfMessagesDelayed |
![]() |
![]() | Note |
|---|---|
Going forward, new attributes might be added. If you are writing code that calls this action, we recommend that you structure your code so that it can handle new attributes gracefully. |
![]() | Note |
|---|---|
Some API operations take lists of parameters. These lists are specified using the &Attribute.1=this &Attribute.2=that |
The following table lists the special request parameters the
GetQueueAttributes action uses in addition to the common request parameters
all actions use (for more information, see Common Query Parameters).
| Name | Description | Required |
|---|---|---|
|
|
The attribute you want to get.
Type: String Valid values: Default: None |
Yes |
The following table lists the response elements the GetQueueAttributes
action returns in addition to the common response elements all actions return (for more
information, see Responses
section in the Amazon SQS Developer Guide.
| Name | Description |
|---|---|
|
|
An element containing each attribute's information. Ancestor: Children:
|
The following table lists the special errors the GetQueueUrl action
returns in addition to the common errors all actions return (for more information, see Common Errors).
| Error | Description | HTTP Status Code |
|---|---|---|
|
|
Unknown attribute |
400 |
The following example Query request gets all the attribute values for the specified queue.
http://sqs.us-east-1.amazonaws.com/123456789012/testQueue/ ?Action=GetQueueAttributes &AttributeName.1=All &Version=2009-02-01 &SignatureMethod=HmacSHA256 &Expires=2009-04-18T22%3A52%3A43PST &AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE &SignatureVersion=2 &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE
<GetQueueAttributesResponse>
<GetQueueAttributesResult>
<Attribute>
<Name>VisibilityTimeout</Name>
<Value>30</Value>
</Attribute>
<Attribute>
<Name>ApproximateNumberOfMessages</Name>
<Value>0</Value>
</Attribute>
<Attribute>
<Name>ApproximateNumberOfMessagesNotVisible</Name>
<Value>0</Value>
</Attribute>
<Attribute>
<Name>CreatedTimestamp</Name>
<Value>1286771522</Value>
</Attribute>
<Attribute>
<Name>LastModifiedTimestamp</Name>
<Value>1286771522</Value>
</Attribute>
<Attribute>
<Name>QueueArn</Name>
<Value>arn:aws:sqs:us-east-1:123456789012:qfoo</Value>
</Attribute>
<Attribute>
<Name>MaximumMessageSize</Name>
<Value>8192</Value>
</Attribute>
<Attribute>
<Name>MessageRetentionPeriod</Name>
<Value>345600</Value>
</Attribute>
</GetQueueAttributesResult>
<ResponseMetadata>
<RequestId>1ea71be5-b5a2-4f9d-b85a-945d8d08cd0b</RequestId>
</ResponseMetadata>
</GetQueueAttributesResponse>The following example Query request gets two attribute values for the specified queue.
http://sqs.us-east-1.amazonaws.com/123456789012/testQueue/ ?Action=GetQueueAttributes &Action=GetQueueAttributes &Version=2011-10-01 &AttributeName.1=VisibilityTimeout &AttributeName.2=DelaySeconds &SignatureMethod=HmacSHA256 &Expires=2011-08-18T22%3A52%3A43PST &AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE &SignatureVersion=2 &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE
<GetQueueAttributesResponse>
<GetQueueAttributesResult>
<Attribute>
<Name>VisibilityTimeout</Name>
<Value>30</Value>
</Attribute>
<Attribute>
<Name>DelaySeconds</Name>
<Value>0</Value>
</Attribute>
</GetQueueAttributesResponse>