Exporting Project Data Using the REST Interface

FlexNet Code Insight 2019 R3

Use the following information to export project data by using a cURL command that calls the exportProjectData REST API.

Important • If copying the cURL command directly from the following instructions for your own use, copy it to a text editor first to remove formatting and any line breaks or extra spaces.

To export project data by calling the exportProjectData REST API, do the following:

1. Ensure that all requirements in Prerequisites for Exporting Data and Prerequisites When Using the REST Interface are met.
2. To initiate the export process, execute the following cURL command to invoke the exportProjectData REST API using the GET method. Replace the highlighted variables with your server host name and port, the project ID, and the authorization token. Also, replace PROJECT_DATA_FILE with the name that you want to give to both the JSON file containing the exported data and the .zip file in which the data file will be compressed.

curl -X GET "HOST:PORT/codeinsight/api/project/exportProjectData?projectId=PROJECT_ID" -H "accept: application/json" -H "Authorization: Bearer JWT_TOKEN" > PROJECT_DATA_FILE.zip

The following is an example:

curl -X GET "http://localhost:8888/codeinsight/api/project/exportProjectData?projectId=55" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInVzZXJJZCI6MSwiaWF0IjoxNTY2ODU5NTg2fQ.qV2j8ZLgNGNJsT8OdPRwvE0-0y1x7w-0zr5h7Jz2d9uqY8tvACsV68posEUO9tD-YXlgXznX-IGnrnopDU7G3w" > ProjectKDR.zip

The status of the export process appears in the command prompt window:

When the export completes, Code Insight generates a .zip archive containing the project data in JSON format and saves it to the directory from which the statement was executed. The archive file name and data file name are the same (except for their extensions). For example, if the export command is executed from the C:/fnci/project_export directory and the output redirect value is ProjectKDR-export-12-22-2020_10-42.zip, the path and file name for the archive would be this:

C:/fnci/project_export/ProjectKDR-export-12-22-2020_10-42.zip

The data file within the archive would be this:

ProjectKDR-export-12-22-2020_10-42.json

Note • If an archive with the same name exists in the export data directory, the archive is overwritten with the new data.

3. Verify that the export process completed successfully. See Verifying a Successful Export.