Project ID

Code Insight 2021 R2

The export and import REST interface requires the ID of the project from which you are exporting data or to which you are importing data, depending on the function being performed. The following procedures describe methods for locating the project ID.

Locating the Project ID in the Code Insight Web UI

The following are some ways to locate the project ID in the Code Insight Web UI.

To obtain the project ID through the Web UI, do the following:

Locate the Name value on the Project Summary page for the project. The ID is displayed in parentheses next to the name:

Retrieving the Product ID Using the REST Interface

Retrieve the project ID by issuing a cURL command that calls the Get Project Id REST API.

Important:If want to copy and paste the cURL command directly from these instructions, copy it to a text editor first to remove formatting and any line breaks or extra spaces.

To obtain the project ID by calling the Get Project Id REST API, do the following:

Execute the following cURL command to invoke the Get Project Id REST API. Replace the highlighted variables with your server host ID (hostname or IP address plus the port), project name, and authorization token.

curl -X GET "HOST:PORT/codeinsight/api/project/id?projectName=PROJECT_NAME" -H "accept: application/json" -H "Authorization: Bearer JWT_TOKEN

The following is an example:

curl -X GET "http://localhost:8888/codeinsight/api/project/id?projectName=AllTypes" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsInVzZXJJZCI6MSwiaWF0IjoxNTY2ODU5NTg2fQ.qV2j8ZLgNGNJsT8OdPRwvE0-0y1x7w-0zr5h7Jz2d9uqY8tvACsV68posEUO9tD-YXlgXznX-IGnrnopDU7G3w

Note:If the project name contains a space or special character, replace the character with its encoded version. For example, for the project project foo, you would provide the name project%20foo, where the space is replaced with the encoded character %20.

The response contains the project ID (in this example, 164):

{"Content: ":164}