使用标准OAS定义导入API。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
apigateway:ImportOAS |
create |
*ApiGroup
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| GroupId |
string |
是 |
API 分组的 ID |
08ae4aa0f95e4321849ee57f4e0b3077 |
| Data |
string |
是 |
OAS 文本内容,或 OSS 链接 |
swagger: "2.0" info: version: "1.0.0" title: "Swagger Petstore 2.0" basePath: "/" schemes: - "https" - "http" paths: /pet/findByStatus: get: tags: - "pet" summary: "Finds Pets by status" operationId: "findPetsByStatus" parameters: - name: "status" in: "query" required: true type: "array" items: type: "string" enum: - "available" - "pending" - "sold" default: "available" collectionFormat: "multi" responses: "200": description: "successful operation" schema: type: "array" items: $ref: "#/definitions/Pet" "400": description: "Invalid status value" definitions: Category: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" Tag: type: "object" properties: id: type: "integer" format: "int64" name: type: "string" Pet: type: "object" required: - "name" - "photoUrls" properties: id: type: "integer" format: "int64" category: $ref: "#/definitions/Category" name: type: "string" example: "doggie" photoUrls: type: "array" items: type: "string" tags: type: "array" items: $ref: "#/definitions/Tag" status: type: "string" description: "pet status in the store" enum: - "available" - "pending" - "sold" |
| Overwrite |
boolean |
是 |
是否覆盖现有 API。 覆盖检测条件为:API 的 HTTP 请求类型+后端请求路径相同。 |
true |
| IgnoreWarning |
boolean |
否 |
忽略警告信息 |
true |
| SkipDryRun |
boolean |
否 |
跳过预检查,进行导入 |
true |
| OASVersion |
string |
否 |
OAS 版本信息 |
OAS2 |
| BackendName |
string |
否 |
后端服务名称 |
testBackendService |
| AuthType |
string |
否 |
API 安全认证类型,目前可以取值:
|
APP |
| RequestMode |
string |
否 |
入参请求的模式,取值为:
|
PASSTHROUGH |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| OperationId |
string |
进行导入操作时生成的异步任务 ID,用来查询导入任务的执行情况 |
c16a1880f5164d779f6a54f64d997cd9 |
| RequestId |
string |
请求 ID |
E7FE7172-AA75-5880-B6F7-C00893E9BC06 |
| ErrorMessages |
object |
||
| ErrorMessage |
array |
OAS 定义中不支持的错误内容 |
|
|
string |
OAS 定义中不支持的错误内容 |
Invalid extensions:x-aliyun-apigateway-auth-type. Option value [ANONYMOUS, APP]. |
|
| WarningMessages |
object |
||
| WarningMessage |
array |
OAS 定义中不支持的警告信息,可以忽略 |
|
|
string |
OAS 定义中不支持的警告信息,可以忽略 |
There is no valid api definition in your file. |
|
| SuccessApis |
object |
||
| SuccessApi |
array<object> |
预检成功的 API 信息 |
|
|
object |
预检成功的 API 信息 |
||
| Path |
string |
创建 API 时配置的请求路径 |
/st1 |
| HttpMethod |
string |
创建 API 时配置的 HTTP 方法 |
POST |
| ApiId |
string |
API 的 ID。 |
92af1abffc2443eaa2b815fdbd9c13f1 |
| ApiOperation |
string |
该 API 是创建(CREATE)或修改(MODIFY) |
CREATE |
| FailedApis |
object |
||
| FailedApi |
array<object> |
预检失败的 API 信息 |
|
|
object |
预检失败的 API 信息 |
||
| Path |
string |
创建 API 时配置的请求路径 |
/st1 |
| HttpMethod |
string |
创建 API 时配置的 HTTP 方法 |
POST |
| ErrorMsg |
string |
错误信息 |
Invalid Api Definition. |
| FailedModels |
object |
||
| FailedModel |
array<object> |
预检失败的模型信息 |
|
|
object |
预检失败的模型信息 |
||
| ErrorMsg |
string |
错误信息 |
Invalid Model Definition. |
| ModelName |
string |
模型名称 |
test |
| GroupId |
string |
API 分组 ID |
2c1bc62e19614cc68c6b0b484bc9c5db |
| SuccessModels |
object |
||
| SuccessModel |
array<object> |
预检成功的模型信息 |
|
|
object |
预检成功的模型信息 |
||
| ModelUid |
string |
模型 uid |
1r4efwee19614cc68c6b0b484bc9c5dbs |
| ModelName |
string |
模型名称 |
test |
| GroupId |
string |
API 分组 ID |
feaccf67040643bcbdedb253e59eb527 |
| ModelOperation |
string |
模型操作,创建(CREATE)或修改(MODIFY) |
CREATE |
示例
正常返回示例
JSON格式
{
"OperationId": "c16a1880f5164d779f6a54f64d997cd9",
"RequestId": "E7FE7172-AA75-5880-B6F7-C00893E9BC06",
"ErrorMessages": {
"ErrorMessage": [
"Invalid extensions:x-aliyun-apigateway-auth-type. Option value [ANONYMOUS, APP]."
]
},
"WarningMessages": {
"WarningMessage": [
"There is no valid api definition in your file."
]
},
"SuccessApis": {
"SuccessApi": [
{
"Path": "/st1",
"HttpMethod": "POST",
"ApiId": "92af1abffc2443eaa2b815fdbd9c13f1",
"ApiOperation": "CREATE"
}
]
},
"FailedApis": {
"FailedApi": [
{
"Path": "/st1",
"HttpMethod": "POST",
"ErrorMsg": "Invalid Api Definition."
}
]
},
"FailedModels": {
"FailedModel": [
{
"ErrorMsg": "Invalid Model Definition.",
"ModelName": "test",
"GroupId": "2c1bc62e19614cc68c6b0b484bc9c5db"
}
]
},
"SuccessModels": {
"SuccessModel": [
{
"ModelUid": "1r4efwee19614cc68c6b0b484bc9c5dbs",
"ModelName": "test",
"GroupId": "feaccf67040643bcbdedb253e59eb527",
"ModelOperation": "CREATE"
}
]
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。