REST Requests

Amazon SQS supports REST requests for calling service actions. REST requests are HTTP requests (see http://www.w3.org/Protocols/rfc2616/rfc2616.html to understand the parts of HTTP requests).

Unlike SQS Query requests, REST requests don't have an Action parameter. Instead the action is indicated by the HTTP method (GET, PUT, etc.) and the request's endpoint. The other parts of SQS REST requests are discussed below.

The REST response is an XML document that conforms to a schema, which is discussed in WSDL and Schema Location.

[Important]Important

The Amazon SQS REST API does not include support for access control. The Query and SOAP APIs do.

The following list describes the main parts of an SQS REST request:

The two examples below show you the different parts of SQS REST requests.

The first example acts on a MessageQueue endpoint generically identified here as QueueURL. For information about what a real queue URL looks like, see About the Queue URL.

[Important]Important

When specifying a queue when using the REST API, you must omit http://queue.amazon.aws.com from the queue URL and provide only what's left. For example, if the full queue URL is http://queue.amazon.aws.com/A29E9WXPHGOG29/queue1, for a REST request you provide only /A29E9WXPHGOG29/queue1. For an example, see the example request in PUT on MessageQueue).

The request sets the visibility timeout for the queue. Note that this action requires the use of query parameters Attribute and Value.

PUT /QueueURL?Attribute=VisibilityTimeout&Value=60 HTTP/1.1
Host: queue.amazonaws.com
Authorization: [AWS authentication string]
Date: Mon, 23 Apr 2007 21:12:00 GMT
Content-Type: text/plain
AWS-Version: 2007-05-01

The second example acts on a Message endpoint generically identified here as QueueURL/MessageID. The request deletes the message from the queue. Note that this action doesn't require the use of any query parameters.

DELETE /QueueURL/MessageId HTTP/1.1
Host: queue.amazonaws.com
Authorization: [AWS authentication string]
Date: Mon, 23 Apr 2007 21:12:00 GMT
Content-Type: text/plain
AWS-Version: 2007-05-01