We are using SonarCloud from command line and want to check the lines of code analyzed to be able to size our projects and know the plan that fit our needs. We don’t want to keep upgrading once the limit reaching of our current plan warning notification is received.
We tried using the API projects and project_analyses but there is no info about the LOC.
It’s a bit of a chicken/egg problem you’re describing if I’m understanding it correctly – your projects need to be analyzed to get the LOC for the plan… but your plan needs to be large enough to analyze those projects.
SonarSource/sonar-loc-count might be useful for sizing your repositories before analyzing / purchasing a plan.
Otherwise, GET api/measures/component is the right API to retrieve the ncloc measure for already analyzed projects.