aws-apps-scripts icon indicating copy to clipboard operation
aws-apps-scripts copied to clipboard

Support different POST content types

Open SanderVanLeeuwen opened this issue 5 years ago • 0 comments

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'});

SanderVanLeeuwen avatar Dec 11 '19 10:12 SanderVanLeeuwen