Reputation: 31
I'm very new to all things-API, and I was instructed to accept a POST request from a website using Lambda, then make a call to another website (Can't disclose websites due to privacy reasons). I'm not entirely sure how to even go about accepting a POST request.
I've experimented with Lambda, so I know how to create them and test them. I just don't know where to go in terms of code.
I'm allowed to use either Java 11 or Python 3.9. Any help is greatly appreciated!
Upvotes: 3
Views: 4764
Reputation: 41
I found it under event:
event['httpMethod']
it can be GET or POST ..etc
Upvotes: 1
Reputation: 17455
In general you will need to put an API Gateway in front of your Lambda. This would receive the HTTP POST and forward it to your Lambda. The Lambda can examine the data that comes in from the POST via API Gateway and call your backend service as needed. It would then return the data to API Gateway that would return it to whatever is calling your service (i.e. browser or other service).
In Java I found a good example here. There are Python examples that are around too.
Upvotes: 4