Updates to Existing APIs

The following section describes updates that have occurred to existing APIs in this release.

Updates to Existing APIs

Resource

API Name/Endpoint

Method

Function Change Description

Jobs

Get job details based on filters

/jobs

GET

This endpoint has changed from /jobs/all to /jobs, and the following filters have been added:

jobType—The type of event that triggered the job: Project Branching, Project Copy, Project Scan, Project Re-Scan, PDL Update, Audit Report, Notices Report, Project Report, Custom Report, Project Deletion.
status—The status of the job: New, Active, Canceled, Completed, Failed, Scheduled, Terminated, Waiting on update.
projectId—The project’s ID.
triggeredBy—The login name of the user who initiated the event that triggered the job.
jobsHistoryInDays—Jobs queued in the last x days, where x is the user-specified value for the filter.

Get job details based on the jobId provided

/jobs/{Id}

GET

“Project Deletion” is shown in the response as the jobType for those jobs that performed (or are performing) a project deletion. (The deleted project name is usually referenced in jobDetails property.)

License

License Lookup

/license/lookup

GET

Previously, if the SPDX identifier did not exist for a license in the Code Insight database, the spdxIdentifier field in the response showed the short name or full name of the license. In this release, if the SPDX identifier is not available in the database, spdxIdentifier now properly shows “N/A” in response.

License lookup based on shortname

/license/{shortname}

Project API

Delete a Project...

projects/{projectId}

DELETE

In previous releases, the project deletion process started immediately. This process is now queued with a job ID and runs in the background. The API returns the response code 202 (changed from 200 in the previous Code Insight release) and a response similar to this example:

{
"message": "Project will be deleted in the
background with the job ID: 1336",
"_links": {
"project-deletion-status": {
"href": "http://<host>:<port>/codeinsight/
api/jobs/1336",
"method": "GET"
}

The URL shown in the response can be called through a REST client to obtain the status updates and details for the deletion. Alternatively, users can call the Get job details based on jobId API for this information.

For more information, see Project Deletions Now Queued and Run in Background and Jobs Queue in this document.

Generate Report

/projects/{projectId}/reports/{reportId}/generate

POST

You are now prevented from generating a report while a scan or rescan on the same project is in queue or in progress. If you attempt to run a report, the response code 503 (Service Unavailable) is returned, and the response shows the error message “Scan is in progress or in queue, please wait till the operation is complete”.

Reports

Delete Report

/reports/{reportId}

DELETE

The reportId instead of reportName is now required to delete a report. The use of reportId avoids issues that resulted when report names contained special characters. The response shows both the reportId and the reportName for the deleted report. A reportId can be obtained through the Get Reports API.

Scan API

Project Scan

/scanResource/projectScan/{projectId}

POST

You are now prevented from triggering a scan or rescan while a report generation on the same project is currently in queue or in progress. If you attempt to trigger a scan, the response code 503 (Service Unavailable) is returned, and the response shows the error message “Report generation is in progress or in queue, please wait till the operation is complete”.