When using the REST interface to execute an import or export, you need to provide the ID of the project from which you are exporting data or the project to which you are importing data.
You can obtain the project ID visually through the FlexNet Code Insight Web UI or programmatically through the REST interface.
Obtaining the Project ID from the FlexNet Code Insight Web UI
The following are just a few options you can use to obtain the project ID from the Web UI.
To obtain the project ID through the Web UI, do either of the following:
• | Locate the Name value on the Project Summary page for the project. The ID is displayed in parentheses: |
Or
• | Locate the project ID included in the URL on any of the project pages, as shown in this example: |
Obtaining the Product ID Through the REST Interface
Obtain the product ID by issuing a cURL command that calls the Get Project Id 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 obtain the project ID by calling the Get Project Id REST API, do the following:
Execute the following cURL command that invokes the Get Project Id REST API using the GET method. Replace the highlighted variables with your server host ID (hostname or IP address) and 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, use project%20foo for a project named project foo.
The response contains the project ID (in this example, 164):
{"Content: ":164}
FlexNet Code Insight 2019 R3 Help LibraryOctober 2019 |
Copyright Information | Flexera |