'Accept a file via API Gateway POST method
I'm building a serverless application which consists of an API Gateway and a Lambda. What I want to do is perform a POST request with a json body AND a file object. The Lambda will read the file object and based on the params in the json body perform some processing on the file and give back results in json format.
Example:
/POST
body {
"id": "C123456",
"format": "echo10",
"file": <xml file that the user uploads>
}
I'm using the LambdaRestAPI construct with proxy set as True.
I've looked around, learned about using binaryMediaTypes, but don't understand how I can get the file AND the json object at the same time.
Another way I've seen is getting the Lambda to get a PreSignedURL for uploading the file to s3, which I don't want to do because 1. I don't want to save the file, 2. it just complicates the architecture.
How can I get what I want?
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | UndoTheUndo |
