rest - 将 API 导入 Azure API 管理时,swagger 字符串去了哪里?

标签 rest azure swagger azure-api-management

我知道它应该放在请求正文中,但它如何与其余元数据相适应?实际 swagger 文本的名称/值对的 NAME 部分是什么?我正在尝试通过传入 swagger 文档的字符串表示形式将 swagger 文档导入到 Azure API 管理中。根据下面的文档,“Content-Type”应设置为“application/vnd.swagger.doc+json”,“import”查询参数应设置为“true”。但是,文档中没有任何内容指定此“导入”参数应该放在哪里。下面是微软提供的 PUT 示例:

PUT/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}?api-version=2016-10-10

是否有一个示例演示如何传入 swagger 字符串以及正文中的所有其他必需参数?:

Apis documentation

最佳答案

要导入 swagger 文件,您需要在以下位置进行 PUT 调用

https://.../apis/ {desired-api-id}?path={desired-api-path-suffix}&import=true&api-version=...

Swagger 内容应按原样进入请求正文,无需任何编码。来自 swagger 的各种信息将用于填写 API 详细信息,它是唯一必须在查询中显式传递的路径,因为在那里找不到它。

关于rest - 将 API 导入 Azure API 管理时,swagger 字符串去了哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44290678/

相关文章:

c# - Azure 服务总线队列 PeekBatch 锁定?

node.js - TSOA Express App 返回无法获取端点

c# - 在 Web API 的 Swagger 文档中支持基于 token 的身份验证

node.js - Swagger - 更改项目目录

java - Jersey 异步 ContainerRequestFilter

Android 非法状态异常 : Could not execute method of the activity

postgresql - nginx:在 PostgreSQL 中存储 POST 数据

powershell - 将备份管理服务添加到 Azure powershell 中的 keyvault

ruby-on-rails - rails : what is the “correct” (idiomatic) way to pass a parameter from new to create in a RESTful controller?

python - 读取 Azure DevOps 管道中的 key 保管库 secret