GetQueueUrl - Amazon Simple Queue Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

GetQueueUrl

Returns the URL of an existing Amazon SQS queue.

To access a queue that belongs to another AWS account, use the QueueOwnerAWSAccountId parameter to specify the account ID of the queue's owner. The queue's owner must grant you permission to access the queue. For more information about shared queue access, see AddPermission or see Allow Developers to Write Messages to a Shared Queue in the Amazon SQS Developer Guide.

Request Syntax

{ "QueueName": "string", "QueueOwnerAWSAccountId": "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.

QueueName

The name of the queue whose URL must be fetched. Maximum 80 characters. Valid values: alphanumeric characters, hyphens (-), and underscores (_).

Queue URLs and names are case-sensitive.

Type: String

Required: Yes

QueueOwnerAWSAccountId

The Amazon Web Services account ID of the account that created the queue.

Type: String

Required: No

Response Syntax

{ "QueueUrl": "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.

QueueUrl

The URL of the queue.

Type: String

Errors

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

InvalidAddress

The accountId is invalid.

HTTP Status Code: 400

InvalidSecurity

When the request to a queue is not HTTPS and SigV4.

HTTP Status Code: 400

QueueDoesNotExist

The specified queue doesn't exist.

HTTP Status Code: 400

RequestThrottled

The request was denied due to request throttling.

  • The rate of requests per second exceeds the Amazon KMS request quota for an account and Region.

  • A burst or sustained high rate of requests to change the state of the same KMS key. This condition is often known as a "hot key."

  • Requests for operations on KMS keys in a Amazon CloudHSM key store might be throttled at a lower-than-expected rate when the Amazon CloudHSM cluster associated with the Amazon CloudHSM key store is processing numerous commands, including those unrelated to the Amazon CloudHSM key store.

HTTP Status Code: 400

UnsupportedOperation

Error code 400. Unsupported operation.

HTTP Status Code: 400

Examples

The following example query request gets the URL for the specified queue. 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 Amazon General Reference.

Example

Using Amazon JSON protocol (default)

Sample Request

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

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: <requestId> Content-Length: <PayloadSizeBytes> Date: <Date> Content-Type: application/x-amz-json-1.0 { "QueueUrl": "https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue" }

Example

Using Amazon 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=GetQueueUrl &QueueName=MyQueue

Sample Response

HTTP/1.1 200 OK <?xml version="1.0"?> <GetQueueUrlResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"> <GetQueueUrlResult> <QueueUrl>https://sqs.us-east-1.amazonaws.com/177715257436/MyQueue</QueueUrl> </GetQueueUrlResult> <ResponseMetadata> <RequestId>552d6f30-4c8e-5b32-aaed-33408c7d6c38</RequestId> </ResponseMetadata> </GetQueueUrlResponse>

See Also

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