0

Does someone have an example of an API Gateway lambda function that receives a path parameter, that is written in python? Every example I can find is written in javascript, and doesn't quite connect for me.

Here's what I mean: from my-template.yaml:

Events:
  Call:
    Type: Api
    Properties:
      Path: /blast-jobs/{id}
      Method: get

I'm not getting something named "id" in my event, what should I be expecting?

1 Answer 1

0

The event your Lambda receives contains a field called pathParameters.

This python Lambda:

def lambda_handler(event, context):
    print(event['pathParameters'])

prints out:

{'id': '987654'}

when this URL is invoked

<gateway_invoke_url>/Prod/blast-jobs/987654

Sign up to request clarification or add additional context in comments.

2 Comments

Please, where is that documented? I was having a really hard time finding it.
I didn't find it in documentation, I just tested it.

Your Answer

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.