10
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

API Gateway -> Lambda(Python)でさくっとクエリ文字列をとる

Posted at

やりたいこと

https://example.com/beta/resource にGETでアクセスした際に、Lambda側でクエリ文字列を取得したい

おこたえ

  1. API Gatewayの Integration Request をクリック
    スクリーンショット 2016-02-03 20.19.44.png

  2. Mapping Templates セクションを開いて、 content-typeapplication/json と入力
    スクリーンショット 2016-02-03 20.21.55.png

  3. 右側の Input passthrough の鉛筆をクリックして、 Mapping Templates を選択
    スクリーンショット 2016-02-03 20.23.38.png

  4. 以下のとおり入力して保存

{
# 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

これでlambda_function()の第一引数の event にクエリ文字列が格納される。

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

10
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?