We are using Sonar 6.7.5. I want to know how can we merge the result of the following APIs. I need this to get metrics data for a given sonar project and for a given timestamp.
Measures API
/api/measures/component?format=json&component=pb&metricKeys=ncloc,violations&includealerts=true
We are trying to build a Streaming Data Platform to load data from Sonar API to a Staging area to build an analytics platform. I have thought of using the following APIs to get the necessary Sonar information.
api/ce/activity - Generate the list of project keys for a given timeframe from the background tasks.
api/measures/search_history - Run this API for all project keys generated from the
Do you think this is the right strategy i.e would you suggest an event based trigger(if there is one) that would serve as input to the second API over using the project keys from the background tasks API?
It gets more interesting as I get more hints what you’re after!
SonarQube has a built-in “event based trigger” called webhooks. Depending on which particular metrics you’re after, it may the only thing you need. After each analysis, your webhooks will be fired and in the payload will be the analysis’ Quality Gate status as well as the values of each of the QG metrics.
Thanks again for the response. I was actually going through the link and I was kind of interested what metrics the payload would include. It looks like the payload only includes metrics configured with Quality Gate.
I am interested in seeing the following metrics. Just wondering if this is possible.
Your understanding is correct. That’s why I said “depending on which particular metrics you’re after”. So it looks like you’ll need to use web services for additional data after all.