查询批量导入任务。任务 ID 由 BatchImportHttpApis 创建批量导入任务后返回;传入空字符串可列出所有已有的批量导入任务。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
apig:GetBatchImportTask |
none |
*全部资源
|
无 | 无 |
请求语法
GET /v1/http-api-batch-import-tasks/{taskId} HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| taskId |
string |
是 |
任务 ID。请先调用 BatchImportHttpApis 创建批量导入任务,并从其返回结果的 taskId 字段获取本参数取值;传入空字符串可列出所有已有的批量导入任务。 |
async-task-xxx |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
当前API无需请求参数
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| requestId |
string |
请求 ID。 |
CE534E1D-FCE4-5930-B784-E055EC1AEE6F |
| code |
string |
响应状态码。 |
Ok |
| message |
string |
响应消息。 |
success |
| data |
object |
返回数据。 |
|
| taskId |
string |
任务 ID。 |
async-task-xxx |
| taskType |
string |
任务类型。 |
BatchImport |
| status |
string |
任务状态,取值:Pending、Running、Success、PartialSuccess、Failed。 枚举值:
|
Running |
| totalCount |
integer |
总数量。 |
10 |
| processedCount |
integer |
已处理数量。 |
5 |
| result |
object |
任务结果详情。 |
|
| apiType |
string |
API 类型。 |
Http |
| gatewayId |
string |
网关实例 ID。 |
gw-xxx |
| dryRun |
boolean |
是否为预检模式。 |
true |
| importRequest |
object |
正式导入请求体。仅预检任务返回,可作为 BatchImportHttpApis 请求体重新提交,dryRun 固定为 false;临时 specFileUrl 仍受 URL 有效期约束。 |
|
| specFileUrl |
string |
OAS ZIP 文件的下载地址,和预检请求保持一致。 |
https://oss-cn-hangzhou.aliyuncs.com/my-bucket/imports/batch.zip |
| specOssConfig |
object |
OAS 文件的 OSS 配置,和预检请求保持一致。 |
|
| regionId |
string |
OSS 所在地域 ID。 |
cn-hangzhou |
| bucketName |
string |
OSS Bucket 名称。 |
my-bucket |
| objectKey |
string |
规格文件在 OSS 存储空间中的对象名(Key)。 |
imports/batch.zip |
| gatewayId |
string |
网关实例 ID。 |
gw-xxx |
| apiType |
string |
API 类型。 |
Http |
| strategy |
string |
导入时的冲突合并策略。 |
ExistFirst |
| withGatewayExtension |
boolean |
是否携带网关扩展配置导入。 |
|
| dryRun |
boolean |
是否为预检模式,正式导入请求体中固定为 false。 |
false |
| allowUpdate |
boolean |
是否允许覆盖更新已有的 API。 |
|
| resourceGroupId |
string |
资源组 ID。 |
rg-xxx |
| successItems |
array<object> |
处理成功的 API 列表。 |
|
|
object |
成功项。 |
||
| fileName |
string |
文件名。 |
petstore.yaml |
| apiId |
string |
API 的 ID。 |
api-xxx |
| apiName |
string |
API 名称,无法识别时返回 unknown。 |
petstore |
| errorMessage |
string |
错误信息。 |
invalid oas format |
| failureItems |
array<object> |
处理失败的 API 列表。 |
|
|
object |
失败项。 |
||
| fileName |
string |
文件名。 |
petstore.yaml |
| apiId |
string |
API 的 ID。 |
api-xxx |
| apiName |
string |
API 名称,无法识别时返回 unknown。 |
petstore |
| errorMessage |
string |
错误信息。 |
invalid oas format |
| dryRunResults |
array<object> |
预检结果列表。 |
|
|
array<object> |
预检结果项。 |
||
| fileName |
string |
文件名。 |
petstore.yaml |
| apiName |
string |
API 名称,无法识别时返回 unknown。 |
petstore |
| dryRunInfo |
object |
预检详情,包含本文件计划创建或更新的操作、路由、组件以及错误告警信息。 |
|
| successOperations |
array<object> |
预检成功的 Rest API Operation 列表。 |
|
|
object |
预检成功的 Rest API Operation 项。 |
||
| action |
string |
预检后将执行的操作类型。 |
Create |
| name |
string |
Rest API Operation 名称。 |
getPetById |
| path |
string |
Rest API Operation 路径。 |
/pets/{petId} |
| method |
string |
Rest API Operation 的 HTTP 方法。 |
GET |
| failureOperations |
array<object> |
预检失败的 Rest API Operation 列表。 |
|
|
object |
预检失败的 Rest API Operation 项。 |
||
| path |
string |
Rest API Operation 路径。 |
/pets/{petId} |
| method |
string |
Rest API Operation 的 HTTP 方法。 |
GET |
| errorMessage |
string |
预检失败原因。 |
unsupported operation |
| successComponents |
array<object> |
预检成功的数据结构列表。 |
|
|
object |
预检成功的数据结构项。 |
||
| action |
string |
预检后将执行的操作类型。 |
Create |
| name |
string |
数据结构名称。 |
Pet |
| failureComponents |
array<object> |
预检失败的数据结构列表。 |
|
|
object |
预检失败的数据结构项。 |
||
| name |
string |
数据结构名称。 |
Pet |
| errorMessage |
string |
预检失败原因。 |
invalid schema |
| successRoutes |
array<object> |
预检成功的路由列表。 |
|
|
object |
预检成功的路由项。 |
||
| action |
string |
预检后将执行的操作类型。 |
Create |
| name |
string |
路由名称。 |
route-pets |
| failureRoutes |
array<object> |
预检失败的路由列表。 |
|
|
object |
预检失败的路由项。 |
||
| name |
string |
路由名称。 |
route-pets |
| errorMessage |
string |
预检失败原因。 |
domain not found |
| errorMessages |
array |
预检错误信息列表。 |
|
|
string |
预检错误信息。 |
invalid oas format |
|
| warningMessages |
array |
预检告警信息列表。 |
|
|
string |
预检告警信息。 |
operation will be overwritten |
|
| existHttpApiInfo |
object |
导入命中的已有 HTTP API 基础信息。 |
|
| httpApiId |
string |
HTTP API 的 ID。 |
api-xxx |
| name |
string |
API 名称。 |
petstore |
| type |
string |
API 类型。 |
Rest |
| basePath |
string |
API 基础路径。 |
/v1 |
| gatewayId |
string |
网关实例 ID。 |
gw-xxx |
| versionInfo |
object |
API 版本控制信息。 |
|
| enable |
boolean |
是否启用版本化控制。 |
true |
| scheme |
string |
版本化方案。 |
Query |
| headerName |
string |
Header 版本化方案时,指定的 Header 参数中的 Key。 |
my-version |
| queryName |
string |
Query 版本化方案时,指定的 Query 参数中的 Key。 |
myVersion |
| version |
string |
版本号。 |
v1 |
| error |
string |
预检错误信息。 |
unsupported oas version |
| errorMessage |
string |
错误信息。 |
some apis import failed |
| createTime |
string |
任务创建时间。时间格式为 RFC 3339 标准的 UTC 时间。 |
2026-05-15T10:00:00Z |
示例
正常返回示例
JSON格式
{
"requestId": "CE534E1D-FCE4-5930-B784-E055EC1AEE6F",
"code": "Ok",
"message": "success",
"data": {
"taskId": "async-task-xxx",
"taskType": "BatchImport",
"status": "Running",
"totalCount": 10,
"processedCount": 5,
"result": {
"apiType": "Http",
"gatewayId": "gw-xxx",
"dryRun": true,
"importRequest": {
"specFileUrl": "https://oss-cn-hangzhou.aliyuncs.com/my-bucket/imports/batch.zip",
"specOssConfig": {
"regionId": "cn-hangzhou",
"bucketName": "my-bucket",
"objectKey": "imports/batch.zip"
},
"gatewayId": "gw-xxx",
"apiType": "Http",
"strategy": "ExistFirst",
"withGatewayExtension": true,
"dryRun": false,
"allowUpdate": true,
"resourceGroupId": "rg-xxx"
},
"successItems": [
{
"fileName": "petstore.yaml",
"apiId": "api-xxx",
"apiName": "petstore",
"errorMessage": "invalid oas format"
}
],
"failureItems": [
{
"fileName": "petstore.yaml",
"apiId": "api-xxx",
"apiName": "petstore",
"errorMessage": "invalid oas format"
}
],
"dryRunResults": [
{
"fileName": "petstore.yaml",
"apiName": "petstore",
"dryRunInfo": {
"successOperations": [
{
"action": "Create",
"name": "getPetById",
"path": "/pets/{petId}",
"method": "GET"
}
],
"failureOperations": [
{
"path": "/pets/{petId}",
"method": "GET",
"errorMessage": "unsupported operation"
}
],
"successComponents": [
{
"action": "Create",
"name": "Pet"
}
],
"failureComponents": [
{
"name": "Pet",
"errorMessage": "invalid schema"
}
],
"successRoutes": [
{
"action": "Create",
"name": "route-pets"
}
],
"failureRoutes": [
{
"name": "route-pets",
"errorMessage": "domain not found"
}
],
"errorMessages": [
"invalid oas format"
],
"warningMessages": [
"operation will be overwritten"
],
"existHttpApiInfo": {
"httpApiId": "api-xxx",
"name": "petstore",
"type": "Rest",
"basePath": "/v1",
"gatewayId": "gw-xxx",
"versionInfo": {
"enable": true,
"scheme": "Query",
"headerName": "my-version",
"queryName": "myVersion",
"version": "v1"
}
}
},
"error": "unsupported oas version"
}
]
},
"errorMessage": "some apis import failed",
"createTime": "2026-05-15T10:00:00Z"
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。