sudhanva
sudhanva

Reputation: 709

Is there a way to send message attributes to SQS through a POST call to the API gateway?

I have a POST API on the API gateway and I call it like so:
https://<url>.amazonaws.com/dev/api?MessageBody=testingAPIGateway

The MessageBody is saved to the body field of the message in SQS. Is there any way to send message attributes as well when I make this call?

Upvotes: 5

Views: 1962

Answers (1)

Daniele Vrut
Daniele Vrut

Reputation: 2873

Just found a solution:

https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue/
?Action=SendMessage
&MessageBody=This+is+a+test+message
&MessageAttribute.1.Name=my_attribute_name_1
&MessageAttribute.1.Value.StringValue=my_attribute_value_1
&MessageAttribute.1.Value.DataType=String
&MessageAttribute.2.Name=my_attribute_name_2
&MessageAttribute.2.Value.StringValue=my_attribute_value_2
&MessageAttribute.2.Value.DataType=String
&Expires=2020-05-05T22%3A52%3A43PST
&Version=2012-11-05
&AUTHPARAMS

Source: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html#API_SendMessage_Examples

Upvotes: 5

Related Questions