I would like to send a HTTPS JSON POST request to AWS SQS, rather than url-encoded. I would like for the whole request, including the Action, the Attributes, the MessageBody, etc. to be within one JSON object.
I am currently trying to do so in Postman. When I do so with a url-encoded body that looks like:
Action=SendMessage&MessageBody=Somemessage
&Expires=2020-10-15T12%3A00%3A00Z
&Version=2012-11-05
I get:
<?xml version="1.0"?>
<SendMessageResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/">
<SendMessageResult>
<MessageId>someid</MessageId>
<MD5OfMessageBody>somemd5</MD5OfMessageBody>
</SendMessageResult>
<ResponseMetadata>
<RequestId>somerequestid</RequestId>
</ResponseMetadata>
</SendMessageResponse>
When I do so with a JSON body that looks like:
{
"Action":"SendMessage",
"MessageBody":"Somejsonmessage",
"Expires":"2020-10-15T12:00:00",
"Version":"2012-11-05"
}
I get:
<AccessDeniedException>
<Message>Unable to determine service/operation name to be authorized</Message>
</AccessDeniedException>
If I change this to:
Action=SendMessage&MessageBody={
"Action":"SendMessage",
"MessageBody":"Somejsonmessage",
"Expires":"2020-10-15T12:00:00",
"Version":"2012-11-05"
}
It works again, but I want to send the whole message as one JSON object.
I have been unable to find out whether or not using a JSON request body is actually legal. Their examples use url-encoded. Is sending a JSON request body legal for AWS SQS? Can you provide me an example?
Thanks.