ClickHelp User Manual

[API] Import API definition

Imports a Swagger/OpenAPI definition to a new project.

POST projects/?action=import&format={formatType}

Authentication

This request requires basic authentication.

Request Parameters

Query params
action
string
Action to perform. Only import is supported.
format
string
Format of Swagger/OpenAPI definition. Can be url or base64.
Body params
importFormat string
Import format. Only AutoDocs is supported.
inputFileName
string
[optional] The name of the Swagger/OpenAPI definition file with an extension.
Required if base64 is selected for the format query parameter. If url format is selected, this parameter is ignored.
inputFileContent
string
[optional] The content of the Swagger/OpenAPI definition file in the base64 format.
Required if base64 is selected for the format query parameter. If url format is selected, this parameter is ignored.
inputFileUrl
string
[optional] The URL of the Swagger/OpenAPI definition file.
Required if url is selected for the format query parameter. If base64 format is selected, this parameter is ignored.
newProjectId
string
[optional] The ID of a new project where to import a definition.
Either newProjectId or newProjectName should be specified.
newProjectName
string
[optional] The name of a new project where to import a definition.
Either newProjectId or newProjectName should be specified.
newProjectLanguageFourLetterCode
string
[optional] A four-letter language code of a new project where to import a definition. If not specified, the en-US code is used.
options
object
Additional import parameters
   __type
string
The type of the import options. For the AutoDocs format, only AutoDocsImportOptions is allowed.
   splitModeType
string
Import mode: GroupMethods, SeparateTopics or SingleTopic

Samples

Request sample
Bash (Unix Shell)
curl --location --request POST 'https://{portal-url}/api/v1/projects/?action=import&format=url' \
--data-raw '{
"importFormat": "AutoDocs",
"inputFileUrl": "https://petstore.swagger.io/v2/swagger.json",
"newProjectName": "OpenAPI via API",
"newProjectId": "openapi-project",
"newProjectLanguageFourLetterCode": "en-US",
"options": {
"__type": "AutoDocsImportOptions",
"splitModeType": "SeparateTopics"
}
}'
Response body sample
JSON
{
"taskKey": "84623f07c1644b12add45da9df56ea9e"
}

Response fields

taskKey
The task key of the import process.