REST API in sonarQub 8.2 community edition

Hi ,

I’m using SonarQube 8.2 community edition.

I’m trying to retrieve Sonar coverage data (either JSON or RAW) using webAPI. But unfortunately i’m not getting exact syntax for getting coverage %.

kindly share some example api query to get exact information. please!!!

I have referred these and tried , but since I’m a new bee to sonar , i’m not clearly understood.

Hi @santothoughts ,

yeah this is a little bit tricky but can be done with a call like this:

<SonarQube-FQDN>/api/measures/search_history?from=<Date>&component=<Full Component Key>&metrics=coverage&ps=1000

you can find more information about this api if you take a look at the embedded documentation of you sonarqube instance <SonarQube-FQDN>/web_api/api/measures?query=search_history

Hope that helps

Ok Thanks!! Just an additional query. what’s Full Component Key here. Is it our project name? and which format DATE will accept? like DDMMYY ?

Hi there,

The Date is like YYYY-MM-DD and the Component key is the one that you can copy from the project information tab.

Thanks a ton Tobias, Worked like a charm !!!

Thanks a ton Tobias, Worked like a charm !!!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.