Amazon API ゲートウェイと Lambda 関数の統合を試みていました。私はうまく達成できましたが、curlで試してみると失敗しました。
Lambda メソッド、API ゲートウェイの統合、および統合リクエストの下のテンプレート マッピングがセットアップされます。
コンソールから「テスト」を実行すると、正常に動作します
Execution log for request test-request
Wed Nov 04 07:27:30 UTC 2015 : Starting execution for request: test-invoke-request
Wed Nov 04 07:27:30 UTC 2015 : API Key: test-invoke-api-key
Wed Nov 04 07:27:30 UTC 2015 : Method request path: {service=xml}
Wed Nov 04 07:27:30 UTC 2015 : Method request query string: {}
Wed Nov 04 07:27:30 UTC 2015 : Method request headers: {}
Wed Nov 04 07:27:30 UTC 2015 : Method request body before transformations: Articletext
Wed Nov 04 07:27:30 UTC 2015 : Endpoint request body after transformations: {
"prog" : "xml",
"content" : "Articletext",
"test" : "{path={service=xml}, querystring={}, header={}}"
}
しかし、カールを介してアクセスしようとすると、変換後に適切なボディを作成できません
curl -X POST https://aaaaaaa.execute-api.us-west-2.amazonaws.com/beta/apitest/xml -H "Content-Type: application/x-www-form-urlencoded; charset=UTF- 8" --data-binary "Articletext"
Starting execution for request:
Method request path: {service=xml}
Method request query string:
{}
Method request body before transformations: Articletext
Endpoint request body after transformations: Articletext
Endpoint response body before transformations:
{
"Type": "User",
"message": "Could not parse request body into json."
}
不足している部分について誰かが私に提案できますか?