Rest Api call to download project pdf report

Hello All,

is there way to download the SonarQube project report pdf using a REST API call?
If any of you can share the curl command it would be of great help.

Regards,
Kumar

Hi Kumar,

Welcome to the community!

Have you tried this via the UI? The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.

You may also find this guide helpful.

 
HTH,
Ann

Hi Ann Campbell,

Thanks for your reply, I UI to check what API calls are being made when tried to download project report but unfortunately no API calls are running when report is downloaded.

Regards,
Kumar

Hi Kumar,

Are you certain you did it exactly like the UI did?

And is the project public or private? Is it possible that you need to authenticate your API call?

 
Ann

Hi Ann Campbell,

I was successfully able to download the project report pdf document.

The userID and password verification was failing, so used the user API token. Got the API call from browser dev tools {Network->Fetch/XHR}.

curl -u THIS_IS_MY_TOKEN: -X GET -H "Content-Type: application/json" "<url>/api/governance_reports/download?componentKey=<projectID>&branchKey=master

Thanks

1 Like

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