2回答
- 新しい順
- 投票が多い順
- コメントが多い順
1
This is doable using an API Gateway Request Mapping Template. First, I've made some assumptions:
- You have a POST or PUT API method with a Request Body json payload something like this: {"cust" : "cust123"}
- In your Integration Request you are making a direct integration call to S3 to GET an object with a Path override that has a path parameter ending with or containing "/{cust}"
If so, add the following Request Mapping Template:
#set($body-json = $util.parseJson($input.json('$')))
#set($context.requestOverride.path.cust = $body-json.cust)
回答済み 9ヶ月前
0
I tried this and got
Method request body before transformations: [Binary Data] Execution failed due to configuration error: Cannot map binary data to parameters
And I have these set in the settings like below,
回答済み 9ヶ月前
The key in your path comes from cust in the json request body. You won't need the URL Path Parameters setting for key since you aren't mapping it any longer, you are setting it in the Mapping template.
関連するコンテンツ
- AWS公式更新しました 10ヶ月前
- AWS公式更新しました 2年前
- AWS公式更新しました 2年前
Thanks for the reply.
The integration request is a direct integration (PUT) into S3. with a path override set to {bucket}/{key}
In URL Path parameters, bucket = 's3_loc' key = method.request.body..$.cust
So based on this, I may have to do,
#set($body-json = $util.parseJson($input.json('$'))) #set($context.requestOverride.path.key = $body-json.cust)