导入 OpenAPI/Swagger 格式数据
POST
https://api.apifox.com/v1/projects/{projectId}/import-openapi
请求示 例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location -g --request POST 'https://api.apifox.com/v1/projects/{{projectId}}/import-openapi?locale=zh-CN' \
--header 'X-Apifox-Api-Version;' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": {
"url": "https://petstore.swagger.io/v2/swagger.json"
},
"options": {
"targetEndpointFolderId": 76,
"targetSchemaFolderId": 60,
"endpointOverwriteBehavior": "OVERWRITE_EXISTING",
"schemaOverwriteBehavior": "KEEP_EXISTING",
"updateFolderOfChangedEndpoint": true,
"prependBasePath": true
}
}'
响应示例响应示例
成功示例
{
"data": {
"counters": {
"endpointCreated": 10,
"endpointUpdated": 0,
"endpointFailed": 0,
"endpointIgnored": 0,
"schemaCreated": 10,
"schemaUpdated": 0,
"schemaFailed": 0,
"schemaIgnored": 0,
"endpointFolderCreated": 0,
"endpointFolderUpdated": 0,
"endpointFolderFailed": 0,
"endpointFolderIgnored": 0,
"schemaFolderCreated": 0,
"schemaFolderUpdated": 0,
"schemaFolderFailed": 0,
"schemaFolderIgnored": 0
}
}
}
请求参数
Path 参数
projectId
string
必需
示例值:
{{projectId}}
Query 参数
locale
string
可选
示例值:
zh-CN
Header 参数
X-Apifox-Api-Version
enum<string>
必需
枚举值:
2024-03-28
Body 参数application/json
返回响应
修改于 2025-03-11 07:40:23