Pull request analysis retrieval via APIs

We’re using SonarQube Enterprise Edition Version 8.2 (build 32929)

We’re trying to retrieve PR scan outcome via SQ APIs and have been trying to use GET api/project_pull_requests/list API. It works fine, but I forsee with the number of PRs getting larger in the system and this API not offering pagination or filter functionality (at least from the docs, and what I have tried) - we’ll run into issues where this call would likely time out.

Are there any plans to offer a search API on PRs? Is there any better way of programatically retrieving results of PR analysis that I have missed?

Thanks in advance!

Sincerely,
Dmitriy

Ideally you’d only keep a reasonable number of P/Rs. That’s why we have the housekeeping feature to clean up inactive P/Rs. In any case, the overhead of that WS is low and I doubt it would be a problem even with hundreds of P/Rs.
In any case, if you know the pull request number in advance and what you’re looking is the status of the quality gate, you can GET directly api/qualitygates/project_status?projectKey=<project-key>&pullRequest=<pr-number>. You’ll get a 404 if that pr hasn’t been analyzed.

1 Like

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