How check Background-Task with API-Wen


I have a question. Can you check the status of an operation via API while it is being validated ?. I am trying with a webhook but it does not serve me 100%.

Thank you

Hello @Oscar_Castro_Pregigu,

Most o fthe Web API operations are synchronous so checking the HTTP return code would tell you if the operation succeeded or not.
The one operation that is asynchronous is analysis report submission (that happens at the end of the scanner execution). That’s probably this particular operation you are referring too (from you thread title).
When the scanners submits an analysis report, it send the report in a SonarQube internal processing queue (the background task queue) that’s processed sequentially by the compute engine.
You can monitor the status of a background (pending, in progress, success, failed) task through the APIs. See api/ce/* set of Web APIs. You have to poll on a regular interval.
Once the scanner is done with the submission, there’s a file left called .scannerwork/report-task.txt left in the workspace, that can be parse to get all the information about the just submitted task, including the taskId.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.