How to pass a querystring value from AWS API Gateway to a Lambda C# function

后端 未结 3 1766
故里飘歌
故里飘歌 2021-01-06 13:14

I have a C# method which I have successfully published as an AWS Lambda function. It looks like this:

public class MyClass
{
    public async Task

        
3条回答
  •  粉色の甜心
    2021-01-06 13:38

    You need to configure the url query string parameter for your request.

    1. go to API gateway

    2. click on your appropriate method i.e. GET method

    3. go to Method Execution

    4. In method execution , select URL Query String Parameter.

    5. Add query String parameter like paramA, paramB

    6. Now go to Integration Request Tab

    7. Choose Body Mapping Template, content type application/json

    8. Generate Template like below

      {
       "paramA":  "$input.params('paramA')",
       "paramB":  "$input.params('paramB')"
      }
      
    9. Accept this key value in pair in lamda function.

    hope this will be helpful.

提交回复
热议问题