Friday, 26 May 2017

Binary Support for API Integrations with Amazon API Gateway - multipart/form-data, application/octet-stream


Binary Support for API Integrations with Amazon API Gateway


Create an API and POST method to support binary, eg: multipart/form-data, application/octet-stream








For API name , enter ‘Thumbnail’, add a description, and choose Create API.



In the created API, choose Resources Actions , and Create Method.








To create the method, choose POST and select the checkmark.














To set up the POST method, for Integration type , select HTTP , enter ‘https://${stageVariables.environmentUrl}’ for Endpoint URL. Choose Save.








Set up the integration

Now, you are ready to set up the integration. In the main page, open Integration Request.















On the Integration Request page, check Use HTTP Proxy integration.For Content Handling , choose Passthrough.















Specify which media types need to be handled as binary. Choose [API name]Binary Support.










Choose Edit , specify the media type (such as “multipart/form-data”) to be handled as binary, and then choose Save.






Choose Edit , specify the media type (such as “application/octet-stream”) to be handled as binary, and then choose Save.




Deployment

Now that the API is configured, you need to deploy it. On the thumbnail Resources page, choose Action , Deploy API.






Testing

Now, you are ready to test the newly created API. 







Reference:
https://aws.amazon.com/blogs/compute/binary-support-for-api-integrations-with-amazon-api-gateway/


No comments:

Post a Comment