GetQueueAttributes

Description

The GetQueueAttributes action gets one or all attributes of a queue. Queues currently have two attributes you can get:

[Important]Important

Before the 2007-05-01 release introduced the GetQueueAttributes action, you retrieved the visibility timeout by using the GetVisibilityTimeout action. As of the 2008-01-01 release of Amazon SQS, the GetVisibilityTimeout action is no longer supported.

Request Parameters

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 Request Parameters Common to All Actions).

NameDescriptionRequired

AttributeName

The attribute you want to get. Setting this value to All returns all the queue's attributes.

Type: String

Valid values: All | ApproximateNumberOfMessages | VisibilityTimeout

Yes

Response Elements

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 Structure of a Successful Response).

NameDescription

Attribute

An element containing each attribute's information.

Ancestor: GetQueueAttributesResult

Children:

  • Name—The attribute.

    Valid values: ApproximateNumberOfMessages | VisibilityTimeout

  • Value—The value for the attribute.

Special Errors

The following table lists the special errors the GetQueueAttributes action returns in addition to the common errors all actions return (for more information, see Errors Common to all Actions).

ErrorDescriptionHTTP Status Code

InvalidAttributeName

Unknown attribute

400

Examples

The following example Query request gets all the attribute values for the specified queue.

Sample Request

http://queue.amazonaws.com/queue2
?Action=GetQueueAttributes
&AttributeName=All
&AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE
&Version=2008-01-01
&Expires=2008-02-10T12:00:00Z
&Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE
&SignatureVersion=2
&SignatureMethod=HmacSHA256

Sample Response

<GetQueueAttributesResponse>
  <GetQueueAttributesResult>
    <Attribute>
      <Name>ApproximateNumberOfMessages</Name>
      <Value>2900</Value>
    </Attribute>
    <Attribute>
      <Name>VisibilityTimeout</Name>
      <Value>35</Value>
    </Attribute>
  </GetQueueAttributesResult>   
    <ResponseMetadata>
      <RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId>
    </ResponseMetadata>
</GetQueueAttributesResponse>

Related Actions