Import projects using the Web API
This section explains how to import your projects and cancel imports using the command line and Web API.
Project admin and Projects root admin roles have access.newProjectName parameter).- To import a given project using
cURL, run the following command: projectis the name of the project you want to importsourceURLis the URL of the existing (source) Klocwork ServersourceAdminis the user ID of the source Klocwork Server's administrator (must haveProjects root adminaccess)sourcePasswordis the administrator's password-
To cancel a queued or in-progress import, run the following command:
-
To check the status of an import or cancellation, run the following command:
-
To list all projects in the source
projects_root, run the following command: -
To import your server configuration settings, run the following command:
curl --data "action=import_project&user=myself&project=my_project&sourceURL= http://oldserver:8080&sourceAdmin=user&sourcePassword=pwd" http://localhost.mycompany.com:8080/review/api
Where:
When you start an import, the response returns the target project ID. Save this value so that you can track or cancel the import.
{ "projectId": "<targetId>" }
curl --data "action=import_project_cancel&user=myself&project=<targetId>" http://localhost.mycompany.com:8080/review/api
If the import is queued and has not started, the server removes it from the queue. If the import is in progress, it stops at the next safe checkpoint and rolls back the imported project's databases, files, and reserved project name. Imported server configuration settings are not rolled back. If the import is already complete or the project ID is unknown, the call returns an error. Sending the cancel request again while cancellation is already in progress does not change the result.
curl --data "action=import_status&user=myself&" http://localhost.mycompany.com:8080/review/api
While a cancellation is in progress, import_status returns cancelling as true. When the cancellation finishes, it returns cancelled as true. The cancelled state is separate from failed.
{ "<targetId>": { "stage": "...", "cancelling": false, "cancelled": true, "failed": false } }
curl --data "action=projects&user=myself&" http://localhost.mycompany.com:8080/review/api
curl --data "action=import_server_configuration&user=myself&sourceURL= http://oldserver:8080&sourceAdmin=user&sourcePassword=pwd" http://localhost.mycompany.com:8080/review/api
cURL calls that use Python.