Not able to backup and restore the quality profiles via api

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sq 6.7.3
  • what are you trying to achieve
    I want to backup the quality profiles via api
  • what have you tried so far to achieve this
    /api/qualityprofiles/backup
    /api/qualityprofiles/restore

Not getting the backup location
Where does he backup reside after using the app?
How can I restore the same backup on another sonar instance

Regards,
Yash Brahmani

Hi,

Take a closer look at the onboard web service documentation (here it is for our dogfooding server), and you’ll see those services have parameters. The section is collapsed by default, which is why you may have missed it before. Just click on the word ‘Parameters’ to see what they are.

Ann

Hi Ann,
When I try to backup the quality profile the response screen is filed with json output. It is not saving the response automatically into the sonar-way.xml file
Can you let me know why such a behaviour.?
I had to save the output manually into an xml file like

Sonar-way.xml

Regards,
Yash Brahmani

Hi,

It sounds like you’re trying to do this through a browser. If that’s the case, then why not just use the UI?

Ann

Hi Ann,
I am working on an ansible custom solution which will export the projects and quality profiles from sonarqube.
Inorder to check if the export via api, I tried to using curl inoder to export the quality profile but in response it fills up the screen with json output.
I am using Linux vm to trigger the curl command.

Regards,
Yash Brahmani

Hi Yash,

Have you tried piping it to a file? Calling the web service directly will only ever return data. What happens to it after that is up to you.

Ann

1 Like

Hi Ann,
Yeah I will need to pipe the output into a file I will need to handle this in ansible.
I was in the intention that the file had to be downloaded via api but that was not the case

Regards,
Yash Brahmani