Project Deployment via Swagger API
This page provides a guide for exporting and importing Codebeamer projects using Swagger API.
Since Codebeamer release 2.0 (HUSKY), projects can be exported and imported using Swagger API as well.
To enable the Export for Deployment and Apply Project Deployment functions, the following needs to be set in the Application Configuration:
"deployment" : {
"enableDocumentTrackers" : false,
"enableExperimentalFeatures" : false,
"enableFieldIdOffset" : false,
"enableLogLastBlacklistCheck" : true,
"enableSelectiveDeployment" : false,
"enabled" : true,
"itemReferenceResolution" : true,
"keepChildRelationsFromNotDeployedProjects" : false,
"maxReferencePathCount" : 100,
"maxWarningsOnUi" : 25,
"trackerHierarchyDeploymentEnabled" : false,
"waitBeforeJobExecutionInSeconds" : 5
}
Export Projects for Deployment via Swagger API
To export projects for deployment via Swagger API,
- Use the POST/v3/deployment/export endpoint in Swagger.
- Add the "projectSettings" details to the Request body field.
For example:
{"projectSettings":[{"projectId":"1607","includeQueries":true,"trackers":[{"trackerId":"3914582","itemsIncluded":true},{"trackerId":"3914583","itemsIncluded":true},{"trackerId":"3914584","itemsIncluded":false},{"trackerId":"3914585","itemsIncluded":false},{"trackerId":"3914586","itemsIncluded":true},{"trackerId":"3914587","itemsIncluded":false},{"trackerId":"3914588","itemsIncluded":false},{"trackerId":"3914589","itemsIncluded":false},{"trackerId":"3914590","itemsIncluded":false},{"trackerId":"3914591","itemsIncluded":false},{"trackerId":"3914592","itemsIncluded":false},{"trackerId":"3914593","itemsIncluded":true},{"trackerId":"3914594","itemsIncluded":true},{"trackerId":"3914595","itemsIncluded":false},{"trackerId":"3914596","itemsIncluded":false}]}],"password":"","exportFileName":"Swagger_deployment_test"}
- Click Execute.
In the Server response section, code 200 is displayed, that is, the export job has been scheduled successfully.
The Response body of code 200 contains the "jobId" which is the ID of the deployment export background job.
- Copy the value of the "jobId" and add it to the jobId field of the GET/v3/job/{jobId} background job endpoint.
- Click Execute.
- In the Server response section, the Response body of code 200 displays the download link for the exported project as the value of the "resultMessage". Copy the download link and paste is to a browser to download the exported project.
The result of exporting projects for deployment via Swagger is the same as when performed on the UI.
Apply Projects Deployment via Swagger API
Projects exported previously for deployment can be imported back to Codebeamer.
To apply projects for deployment via Swagger API,
- Use the POST/v3/deployment endpoint in Swagger.
- In the Request body section, select the deployment file in to be imported.
Based on your deployment related settings in the Application Configuration, set the values (true or false) of the importTrackerHierarchy and skipRefreshComputedFields fields, if necessary.
- Click Execute.
In the Server response section, code 200 is displayed, that is, the deployment import has been successful.
The Response body of code 200 contains the "jobId" which is the ID of the deployment import background job.
- Copy the value of the "jobId" and add it to the jobId field of the GET/v3/job/{jobId} background job endpoint.
- Click Execute.
In the Server response section, the Response body of code 200 displays the details of the successfully finished deployment import process.
The result of applying project deployment via Swagger is the same as when performed on the UI.
For further information on project deployment, see Project Configuration Deployment Across codebeamer Instances.