Import OpenAPI/Swagger Data
POST
/v1/projects/{projectId}/import-openapiFunction Description
Currently supports importing data in OpenAPI 3, Swagger 2 formats.
The extensions have been added on top of standard Swagger/OpenAPI
Please check here to know more about Apidog OpenAPI Specification Extensions.
Request
The OpenAPI specification you want to import, either as a string or a URL.
For string
, it is defined as a YAML, X-YAML, or stringified JSON object.
An import process object containing advanced options and their values.
The ID of the target folder for storing or matching Endpoints. If not specified, the target folder will be the Root
folder.
The ID of the target folder to store or matching data schemas. If not specified, the target folder will be the Root
folder.
Specify the behavior for handling matched API Endpoints. Determine whether to override existing API Endpoints, automatically merge changes, skip changes and keep existing API Endpoints, or create new API Endpoints.
Specify how to handle matching data schemas. Determine whether to overwrite the existing schema, automatically merge changes, skip changes and keep the existing schema, or create a new schema.
Whether to update the catalog ID of the API when importing matching existing API Endpoints. If you want to change the catalog ID along with the imported API, you should set it to true.
Whether to add the base path to the path of the API, the default setting is false. We recommend setting it to false, so that the base path can be retained in the "Environment" instead of inside each API Endpoint. If you want to add a path prefix to the API Endpoint path, you should set it to true.
{
"input": "string",
"options": {
"targetEndpointFolderId": 0,
"targetSchemaFolderId": 0,
"endpointOverwriteBehavior": "OVERWRITE_EXISTING",
"schemaOverwriteBehavior": "OVERWRITE_EXISTING",
"updateFolderOfChangedEndpoint": false,
"prependBasePath": false
}
}
Request samples
Responses
{
"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
}
}
}