My question:
I am using SonarQube version 7.1 and trying to extract the metrics and quality gate related to individual projects.
What we
You could do this:
Call the API api/metrics/search
first to get a (json) list of all the metrics and then iterate over that list and create a comma separated string of all the metric keys.
For example something like this: ncloc,complexity,violations
.. as mentioned in the parameters example value in the API documentation here.
Then you could just add this comma separated list to the url as a parameter something like: http://MY_HOST/api/measures/component?metricKeys=ncloc,complexity,violations&component=project_key
and call it once to get the response for all metrics.
Also, I haven't tried this, but as per the latest documentation, the parameter component
is optional. So if you omit that, ideally you should get a response with metrics of all the projects.