Hello,
I’m trying to get the “private lines of code analyzed” from our Sonar organization through the API SonarCloud .
Using the APIs provided by Sonar, I don’t get the same result as in the SonarCloud interface.
I use the following endpoints:
Is there another way to get the “private lines of code analyzed” via API?
Thanks,
Colin
(Colin)
May 23, 2023, 1:38pm
2
A user with Administer Organization permissions can use the internal API GET api/billing/show with the organization
parameter. This is an internal API subject to change without notice.
https://sonarcloud.io/api/billing/show?organization= <ORG_KEY>
This API endpoint returns values like nclocCount
(representing private projects)
I’m crying.
Why isn’t this documented somewhere?
Thanks for the answer by the way.
Colin
(Colin)
May 23, 2023, 2:16pm
4
Internal APIs stay internal so we have the flexibility to change them however we want without worrying about compatibility.
It’s a great question – why isn’t there a Public API with this information I’m happy to move your thread over to Product Manager for a Day - Sonar Community
And, in the future, if there’s data you see in the UI you can’t seem to figure out how to get via the API, keep this in mind:
Every action that is taken in the SonarQube / SonarCloud UI is driven by the Web API. There is nothing you can do in SonarQube / SonarCloud that you cannot do using the Web API.
We put a great deal of effort into the UI and UX of our products and sincerely think that most actions should be completed there. Especially when it comes to viewing analysis results, the UI is the best place to view up-to-date information with the right context. We think it is much better that you give access…