How to get Lines of code for a project in SonarQube community Edition

Hi Team,

We are using SonarQube Community Edition - Version 8.9.7 and trying to get the Lines of code and metric details for SonarQube Projects.
We tried below API -
{your_sonar_url}/api/measures/component?componentKey={your_project_key}&metricKeys=ncloc

But we are getting the error message as -
“The ‘component’ parameter is missing”

Can you please help us with the correct API to achieve this ?

Thanks !

You should use component rather than componentKey as your query parameter. componentKey is not documented in the Web API documentation.

Thanks! This worked