1

I have set up API Gateway endpoint like this:

GET files/{filename}

Therefore, I would call it something like this: https://mydomain/api/files/somefile

I have also a lambda function with Nodejs which is empty:

exports.handler = function(event, context) {

//Retrieve here the param called 'filename' and do something with it

};

How can I get the param passed on the GET request?. I have checked out the event and context objects but I could not find anything helpful.

Thanks!!

asked Apr 18, 2016 at 14:38

1 Answer 1

5

To get path parameters, HTTP header variables (etc) you must create a mapping template.

  1. From the API Gateway console, select your get resource and you should see a panel w/4 boxes.
  2. Click on "Integration Request" (top right box)
  3. Expand "body mapping template" on bottom
  4. Define content type (most likely "application/json")
  5. Try "generate template:method request passthru" to get started
  6. Save
  7. Now try "Test" for your HTTP Get, and hopefully you will see the missing path param, etc.

Good luck.

answered Apr 18, 2016 at 15:10
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.