Amazon Simple Queue Service
API Reference (API Version 2012-11-05)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

GetQueueUrl

Description

The GetQueueUrl action returns the Uniform Resource Locater (URL) of a queue. This action provides a simple way to retrieve the URL of an 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 go to Shared Queues in the Amazon SQS Developer Guide.

Request Parameters

The following table lists the special request parameters the GetQueueUrl action uses in addition to the common request parameters all actions use. For more information, see Common Query Parameters.

NameDescriptionRequired

QueueName

The name of an existing queue.

Type: String

Constraints: Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed.

Yes

QueueOwnerAWSAccountId

The AWS account ID of the account that created the queue.

Type: String

No

Response Elements

The following table lists the response elements the GetQueueUrl action returns in addition to the common response elements all actions return. For more information, see Responses section in the Amazon SQS Developer Guidee.

NameDescription

QueueUrl

The queue URL for the queue that you created.

Type: String

Ancestor: GetQueueUrlResult

Special Errors

A special error can result if you attempt to access a queue that doesn't exist in the named account or if you don't have permission to access the queue.

Examples

The following example Query request gets the URL for the specified queue.

Sample Request

http://sqs.us-east-1.amazonaws.com/
?Action=GetQueueUrl
&QueueName=testQueue
&Version=2011-10-01
&SignatureMethod=HmacSHA256
&Expires=2011-10-24T22%3A52%3A43PST
&AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE
&SignatureVersion=2
&Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE

Sample Response

<GetQueueUrlResponse>
    <GetQueueUrlResult>
        <QueueUrl>
            http://sqs.us-east-1.amazonaws.com/123456789012/testQueue
        </QueueUrl>
    </GetQueueUrlResult>
    <ResponseMetadata>
        <RequestId>470a6f13-2ed9-4181-ad8a-2fdea142988e</RequestId>
    </ResponseMetadata>
</GetQueueUrlResponse>