我在API网关中创建了一个基本的GET url;其中包含一个名为"name“的路径参数。
我如何访问这个名称param?无论是事件还是背景,我都没有看到。
我是不是弄错了参数路径的目的?
例如,让我使用我的play应用程序:
GET /api/v1/person @controllers.PersonController.list(limit: Int ?= 50, offset: Long ?= 0)
GET /api/v1/person/$id<[0-9]+> @controllers.PersonController.getById(id: Long)
GET /api/v1/person/$id<[0-9]+>/email @controllers.PersonController.getEmailByPersonId(id: Long)使用API网关可以实现这一点吗?
发布于 2015-11-06 00:34:09
根据文档,您应该能够使用映射模板来完成此操作:http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
修改它们的示例(接近底部的“示例请求和响应”)以适应您的URI --如下所示
//Resource: /api/v1/person/{id}
//With input template(this is what your lambda will see in the event):
{
"id" : "$input.params('id')"
"person" : $input.json(‘$.person')
}
//POST /api/v1/person/{id}
{
"person" : {
"name": "bob"
}
}https://stackoverflow.com/questions/33555279
复制相似问题