如何重命名 AWS API 网关 API 实例?

How to rename an AWS API Gateway API instance?

在 AWS API 网关中,是否可以以某种方式重命名 API 实例?

我在 UI 上没有看到该选项,但也许可以通过一些 API 调用来实现。

是的,它在 API 或 CLI 中可用。

在 API 中,您在 'name' 字段上使用 PATCH 请求。 http://docs.aws.amazon.com/apigateway/api-reference/resource/rest-api/

在 CLI 中,请参阅文档 http://docs.aws.amazon.com/cli/latest/reference/apigateway/update-rest-api.html

PATCH 操作是 'replace',路径是“/name”

编辑:感谢@Canotto90 提供示例

aws apigateway update-rest-api --rest-api-id IDOfTheAPIThatNeedsTobeUpdated --patch-operations op=replace,path=/name,value=NewName

以下是获取 API 列表及其 ID 的方法:

aws apigateway get-rest-apis

使用 Id 更新 API 的名称,如上文 Canotto90 所述:

aws apigateway update-rest-api --rest-api-id IDOfTheAPIThatNeedsTobeUpdated --patch-operations op=replace,path=/name,value=NewName

我知道这是一个老问题,但人们可能仍然像我刚才那样需要答案。

Amazon 的 AWS UI 并不总是很清楚。没有 "Rename" 函数来更改现有 API 的名称。但是,可以通过克隆现有的 API.

来完成

要重命名您的 API,请单击 "Create API" 按钮和 select "Clone from existing API"。这将允许您给它一个新名称。

事实证明,现在有一种方法可以重命名 API!

在亚马逊 API 网关服务下,select APIs。您将看到 API 的列表。

现在,单击要重命名的 API 右上角的小齿轮...

只需更改名称,点击保存即可!

https://console.aws.amazon.com/apigateway -> Select API 按名称 -> 设置 -> 常规设置 -> 名称

最新版本的控制台允许您通过 API 设置编辑名称:see where in console here