red*_*888 5 amazon-web-services aws-cli aws-lambda aws-api-gateway
我想运行此命令:https://docs.aws.amazon.com/cli/latest/reference/apigateway/test-invoke-method.html
它需要这两个字段,无法找到任何文档,这些是:
aws apigateway test-invoke-method --rest-api-id 1234123412 --resource-id avl5sg8fw8 --http-method GET --path-with-query-string '/'
Run Code Online (Sandbox Code Playgroud)
我的API网关端点如下所示:
https://abc123.execute-api.us-east-1.amazonaws.com/MyStage/
Run Code Online (Sandbox Code Playgroud)
我只看到那里的唯一标识符 - 但是这个命令似乎需要两个ID.我在哪里可以在API网关控制台中找到它们?
您的rest-api-id是端点URL中'execute-api'之前的标识符.
在您的示例网址中:
https://abc123.execute-api.us-east-1.amazonaws.com/MyStage/
Run Code Online (Sandbox Code Playgroud)
该rest-api-idISabc123
可以使用CLI使用get-resources调用和rest-api-id 获取资源ID :
> aws apigateway get-resources --rest-api-id abc123
{
"items": [
{
"id": "xxxx1",
"parentId": "xxxx0",
"pathPart": "foo",
"path": "/foo",
"resourceMethods": {
"GET": {}
}
},
{
"id": "xxxx0",
"path": "/"
}
]}
Run Code Online (Sandbox Code Playgroud)
items属性中的每个记录都是一个资源,其id属性是您可以在test-invoke-method中使用的资源ID以及与该资源关联的方法.
| 归档时间: |
|
| 查看次数: |
2468 次 |
| 最近记录: |