I have connected an Api Gateway method to push onto a SQS Queue by following this tutorial.
https://dzone.com/articles/creating-aws-service-proxy-for-amazon-sqs
This all works fine but I would like to add some Message Attributes to my messages using some path parameters but I can not get it to work.
This is the current Mapping Template from the tutorial.
Action=SendMessage&MessageBody=$util.urlEncode($util.escapeJavaScript($input.json('$')))
I've tried to keep the 'application/x-www-form-urlencoded' format and add the MessageAttributes to this by changing it to (using a static value for now)
Action=SendMessage&MessageBody=$util.urlEncode($util.escapeJavaScript($input.json('$')))
&MessageAttribute[0][Name]=foo&MessageAttribute[0][Type]=String&MessageAttribute[0][Value]=bar
but I get this error back
{
"Error": {
"Code": "MalformedQueryString",
"Message": "Keys may not contain [",
"Type": "Sender"
},
"RequestId": "ea121e6e-ca37-5d14-b92b-4a2c6fedf403"
}
How should I encode an array of MessageAttribues without using '['