Menu
Amazon Simple Queue Service
Developer Guide

Responses

In response to an action request, Amazon SQS returns an XML data structure that contains the results of the request. This data conforms to the Amazon SQS schema. For more information, see the API version in the Amazon SQS API Reference.

Structure of a Successful Response

If the request succeeded, the main response element is named after the action, but with "Response" appended. For example, CreateQueueResponse is the response element returned for a successful CreateQueue request. This element contains the following child elements:

  • ResponseMetadata, which contains the RequestId child element

  • An optional element containing action-specific results; for example, the CreateQueueResponse element includes an element called CreateQueueResult

The XML schema describes the XML response message for each Amazon SQS action.

The following is an example of a successful response.

<CreateQueueResponse
  xmlns=http://sqs.us-east-2.amazonaws.com/doc/2012-11-05/
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
  xsi:type=CreateQueueResponse>
     <CreateQueueResult>
        <QueueUrl>
        http://sqs.us-east-2.amazonaws.com/770098461991/queue2
        </QueueUrl>
     </CreateQueueResult>
     <ResponseMetadata>
        <RequestId>cb919c0a-9bce-4afe-9b48-9bdf2412bb67</RequestId>
     </ResponseMetadata>
</CreateQueueResponse>

Structure of an Error Response

If a request is unsuccessful, the main response element is called ErrorResponse regardless of the action that was called. This element contains an Error element and a RequestId element. Each Error includes:

  • A Type element that identifies whether the error was a producer or consumer error

  • A Code element that identifies the type of error that occurred

  • A Message element that describes the error condition in a human-readable form

  • A Detail element that might give additional details about the error or might be empty

The following is an example of an error response.

<ErrorResponse>
   <Error>
      <Type>
         Sender
      </Type>
      <Code>
         InvalidParameterValue
      </Code>
      <Message>
         Value (quename_nonalpha) for parameter QueueName is invalid.
         Must be an alphanumeric String of 1 to 80 in length
      </Message>
   </Error>
   <RequestId>
      42d59b56-7407-4c4a-be0f-4c88daeea257
   </RequestId>
</ErrorResponse>