Quickly take a query string with API Gateway-> Lambda (Python)

Thing you want to do

I want to get the query string on the Lambda side when accessing https://example.com/beta/resource with GET

Wake up

  1. Click ʻIntegration Request` in API Gateway スクリーンショット 2016-02-03 20.19.44.png

  2. Open the Mapping Templates section and enter ʻapplication / json in content-type` スクリーンショット 2016-02-03 20.21.55.png

  3. Click the ʻInput passthrough pencil on the right and select Mapping Templates` スクリーンショット 2016-02-03 20.23.38.png

  4. Enter and save as follows

{
#foreach( $key in $input.params().querystring.keySet() )
    "$key": "$input.params().querystring.get($key)"#if( $foreach.hasNext ),#end
#end
}

スクリーンショット 2016-02-03 20.22.41.png

Now the query string is stored in the first argument ʻevent` of lambda_function ().

Reference: http://r7kamura.hatenablog.com/entry/2015/08/14/043134

Recommended Posts

Quickly take a query string with API Gateway-> Lambda (Python)
Create API with Python, lambda, API Gateway quickly using AWS SAM
LINE BOT with Python + AWS Lambda + API Gateway
Try implementing a Cisco Spark bot with AWS Lambda + Amazon API Gateway (Python)
[AWS] Create API with API Gateway + Lambda
AWS Amplify + API Gateway + Lambda + Python returns a normal response
I tried ChatOps with Slack x API Gateway x Lambda (Python) x RDS
[Python] I wrote a REST API using AWS API Gateway and Lambda.
LINE BOT (Messaging API) development with API Gateway and Lambda (Python) [Part 2]
[Python] Quickly create an API with Flask
Easy REST API with API Gateway / Lambda / DynamoDB
I tried to make "Sakurai-san" a LINE BOT with API Gateway + Lambda
[AWS SAM] Create API with DynamoDB + Lambda + API Gateway
View images on S3 with API Gateway + Lambda
[AWS] Try tracing API Gateway + Lambda with X-Ray
Quickly build a Python Django environment with IntelliJ
Decrypt a string encrypted on iOS with Python
Amazon API Gateway and AWS Lambda Python version
Create an API server quickly with Python + Falcon
[Python] Take a screenshot
A python lambda expression ...
How to convert / restore a string with [] in python
Playing with a user-local artificial intelligence API in Python
[Blender] Complement Blender's Python API with a text editor
Register a ticket with redmine API using python requests
Create a Layer for AWS Lambda Python with Docker
[Piyopiyokai # 1] Let's play with Lambda: Creating a Python script
[Vagrant] Set up a simple API server with python
Take a screenshot in Python
Try hitting the Twitter API quickly and easily with Python
Use Trello API with python
Operate TwitterBot with Lambda, Python
A note about hitting the Facebook API with the Python SDK
Determine if a string is a time with a python regular expression
Made "Unofficial Apple Refurbished Product Introduction" BOT with LINE Messaging API (v2) + API Gateway + lambda (python)
AWS CDK-Lambda + API Gateway (Python)
Use Twitter API with Python
[Python] Use a string sequence
I wrote a program quickly to study DI with Python ①
A memo when face is detected with Python + OpenCV quickly
Query Athena from Lambda Python
Web API with Python + Falcon
Make a fortune with Python
Play RocketChat with API / Python
Call the API with python3.
Create a message corresponding to localization with python translation string
Use subsonic API with python3
Create a directory with python
String format with Python% operator
I wrote a script to create a Twitter Bot development environment quickly with AWS Lambda + Python 2.7
Convert to a string while outputting standard output with Python subprocess
Rubyist tried to make a simple API with Python + bottle + MySQL
A story about adding a REST API to a daemon made with Python
[Introduction to Python] How to split a character string with the split function
[Python 3.8 ~] How to define a recursive function smartly with a lambda expression
Send images taken with ESP32-WROOM-32 to AWS (API Gateway → Lambda → S3)
Try to extract a character string from an image with Python3
I made a Twitter Bot with Go x Qiita API x Lambda
Make a request from Device Farm (appium python) to API Gateway
[LINE Messaging API] Create a BOT that connects with someone with Python
How to send a request to the DMM (FANZA) API with python