在哪里可以获取API网关调用的示例json事件?从API Gateway控制台测试api网关会截断大多数输出,因此在那里似乎没用。
我想尝试直接通过json测试事件向我的lambda发送一个api网关事件。 api网关发送lambda事件的记录示例在哪里?
答案 0 :(得分:2)
API网关代理事件消息示例在这里:https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html
但是,如果您使用的是Lambda自定义集成类型,则该事件将包含API Gateway映射模板说应包含的内容。
答案 1 :(得分:1)
这对我有用 https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html
(来自上面的链接)
{
"resource": "/",
"path": "/",
"httpMethod": "GET",
"requestContext": {
"resourcePath": "/",
"httpMethod": "GET",
"path": "/Prod/",
...
},
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-encoding": "gzip, deflate, br",
"Host": "70ixmpl4fl.execute-api.us-east-2.amazonaws.com",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
"X-Amzn-Trace-Id": "Root=1-5e66d96f-7491f09xmpl79d18acf3d050",
...
},
"multiValueHeaders": {
"accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
],
"accept-encoding": [
"gzip, deflate, br"
],
...
},
"queryStringParameters": null,
"multiValueQueryStringParameters": null,
"pathParameters": null,
"stageVariables": null,
"body": null,
"isBase64Encoded": false
}