ListQueues - Amazon Simple Queue Service

ListQueues

Returns a list of your queues in the current region. The response includes a maximum of 1,000 results. If you specify a value for the optional QueueNamePrefix parameter, only queues with a name that begins with the specified value are returned.

The listQueues methods supports pagination. Set parameter MaxResults in the request to specify the maximum number of results to be returned in the response. If you do not set MaxResults, the response includes a maximum of 1,000 results. If you set MaxResults and there are additional results to display, the response includes a value for NextToken. Use NextToken as a parameter in your next request to listQueues to receive the next page of results.

Note

Cross-account permissions don't apply to this action. For more information, see Grant cross-account permissions to a role and a username in the Amazon SQS Developer Guide.

Request Syntax

{ "MaxResults": number, "NextToken": "string", "QueueNamePrefix": "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.

MaxResults

Maximum number of results to include in the response. Value range is 1 to 1000. You must set MaxResults to receive a value for NextToken in the response.

Type: Integer

Required: No

NextToken

Pagination token to request the next set of results.

Type: String

Required: No

QueueNamePrefix

A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.

Queue URLs and names are case-sensitive.

Type: String

Required: No

Response Syntax

{ "NextToken": "string", "QueueUrls": [ "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.

NextToken

Pagination token to include in the next request. Token value is null if there are no additional results to request, or if you did not set MaxResults in the request.

Type: String

QueueUrls

A list of queue URLs, up to 1,000 entries, or the value of MaxResults that you sent in the request.

Type: Array of strings

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidAddress

The specified ID is invalid.

HTTP Status Code: 400

InvalidSecurity

The request was not made over HTTPS or did not use SigV4 for signing.

HTTP Status Code: 400

RequestThrottled

The request was denied due to request throttling.

  • Exceeds the permitted request rate for the queue or for the recipient of the request.

  • Ensure that the request rate is within the Amazon SQS limits for sending messages. For more information, see Amazon SQS quotas in the Amazon SQS Developer Guide.

HTTP Status Code: 400

UnsupportedOperation

Error code 400. Unsupported operation.

HTTP Status Code: 400

Examples

The following example query request returns the queues whose names begin with the letter t The structure of AUTHPARAMS depends on the signature of the API request. For more information, see Examples of Signed Signature Version 4 Requests in the AWS General Reference.

Example

Using AWS JSON protocol (Default)

Sample Request

POST / HTTP/1.1 Host: sqs.us-east-1.amazonaws.com X-Amz-Target: AmazonSQS.ListQueues X-Amz-Date: <Date> Content-Type: application/x-amz-json-1.0 Authorization: <AuthParams> Content-Length: <PayloadSizeBytes> Connection: Keep-Alive { "QueueNamePrefix": "My" }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: <requestId> Content-Length: <PayloadSizeBytes> Date: <Date> Content-Type: application/x-amz-json-1.0 { "QueueUrls": [ "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue", "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648169377027", "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648169549830", "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648227401019", "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648248132466", "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1649201932174", "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue2" ] }

Example

Using AWS query protocol

Sample Request

POST / HTTP/1.1 Host: sqs.us-east-1.amazonaws.com Content-Type: application/x-www-form-urlencoded X-Amz-Date: <Date> Authorization: <AuthParams> Content-Length: <PayloadSizeBytes> Connection: Keep-Alive Action=ListQueues&QueueNamePrefix=M

Sample Response

HTTP/1.1 200 OK <?xml version="1.0"?> <ListQueuesResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"> <ListQueuesResult> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648169377027</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648169549830</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648227401019</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1648248132466</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue1649201932174</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue22</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue23</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue233</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue5</QueueUrl> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueueTest</QueueUrl> </ListQueuesResult> <ResponseMetadata> <RequestId>f525e5e2-86cd-5d1b-aee9-b992443254c0</RequestId> </ResponseMetadata> </ListQueuesResponse>

See Also

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