Requirement to retrieve new code vulnerabilities count for Blocker, Critical, Major, Minor, Info

Hi All:

Have a requirement to retrieve the New Code Vulnerabilities severities for instance - Blocker, Critical, Major, Minor, Info. Have used the below Web API’s for retrieving the overall code vulnerabilities severities:
api/issues/search?types=VULNERABILITY&statuses=OPEN,CONFIRMED,REOPENED&ps=500&projects=my_project&facets=severities
Could you please direct me if there is an existing web api that could be used for retrieving the New Code Vulnerabilities severity?
The only metric key that we got from the list of metrics from this api - /api/metrics/search?ps=500 was ‘new_vulnerabilities’ and this doesn’t have a breakdown of the severities for the new code.
Any help is highly appreciated
Thanks,
David

Welcome :slight_smile:

you didn’t mention your Sonarqube version, but this should work !?

api/issues/search?inNewCodePeriod=yes&ps=500&componentKeys=<yourProjectKey>&severities=BLOCKER,CRITICAL,MAJOR,MINOR,INFO&facets=severities,rules

Gilbert

1 Like

Hi Gilbert:
And by the way forgot to mention version, it is 9.9.0
And, finally, thanks for pointing the link, didn’t clearly search the ‘search-api’. The link works perfectly as required
Thanks,
David