Can someone let me know the data quality of API results and how frequently can we expect data through API?
Is there a way I will know when the analysis got over for me to fire an API call
Can someone let me know the data quality of API results and how frequently can we expect data through API?
Is there a way I will know when the analysis got over for me to fire an API call
Hello @Bhuvaneshwari_Kannan,
Can you provide context please. We cannot help you if you don’t elaborate more than that.
Olivier
Hello Olivier,
I am trying to consume API.
How much time it takes for data to be reflected in API when an analysis is complete?
Are API data 100% accurate?
Other than webhooks, is there a way I can call API when an analysis is complete
Hello,
OK. API is 100% accurate BUT when you have just analyzed a project, you must wait that the project processing in SonarQube is complete (ie that the background task is successfully complete) before you get the data of that analysis.
If you invoke the API before this is complete you will get the results of the previous analysis.
Having a web hook to trigger the execution of your script that consumes APIs is the best way to make sure you consume the APIs at the right moment.
If webhook is too complicated or whatever, you can also poll SonarQube with the api/ce/*
APIs. You must first retrieve the taskId
for the analysis report that has just been submitted by the scanner, and then loop on polling on the taskId
status until it’s no longer PENDING
(still in the queue) or IN_PROGRESS
(under processing).
It can end up as SUCCESS
(vast majority of cases), FAILED
or CANCELED
.
If SUCCESS
then it’s time to invoke the API to get what you want about the project.
If any other outcome, then something went wrong and the latest project results will never be available. You’ll always get the result of the last previous successful analysis.
Olivier
Wow . This is awesome . Thanks a lot