aws-apps-scripts
aws-apps-scripts copied to clipboard
Support different POST content types
By default, POST data is formatted as JSON. Not all AWS services accept JSON though, in our example, Amazon SES. I used the existing options
parameter to supply a different content type (in this case application/x-www-form-urlencoded
) and format / hash the payload accordingly.
GET requests in UrlFetchApp are limited to 2kB so by using a POST instead we can send requests up to 50MB: AWS.request('email', 'eu-west-1', 'SendEmail', undefined, 'POST', payload, undefined, undefined, {contentType: 'application/x-www-form-urlencoded'});