Automation of Export/Import project through REST API


(Fangfang Cai) #1
  • Sonar Version 6.7.3 (build 38370), Scan Version 3.0
  • automation of export/import project through REST API
  • We have a business requirement to clean up some of our existing projects in Sonar.

Here is I try to do:

  1. Update the projectKey through API

  2. Export a project through the following API:
    POST:https://sonar.aexp.com/api/project_dump/export
    The zip file is exported under data/governance/project_dumps/export.

  3. Delete this project through API
    POST:https://sqdev.aexp.com/api/projects/delete

  4. Create a new project with new key and import this project through API
    POST:https://sonar.aexp.com/api/projects/create

  5. Upload historic data from zip file
    POST:https://sonar.aexp.com/api/project_dump/import

But the issue I have is the zip file is NOT under data/governance/project_dumps/import directory as required.

Also we have two App Servers and not sure which server have this file.

Is any way we can just download this zip file into our local file system through API?

Thanks,

Fangfang


(G Ann Campbell) #2

Hi Fangfang,

If I understand correctly, you perform a project export - or attempt to - yet no file is delivered? Do you see an error on the project? I ask because it appears that export failures aren’t communicated well (SONAR-10741). Also, do you see anything in your server logs?

And to answer your question, there’s not currently a way to download the file via APIs. We’ve got tickets in for that though (SONAR-10753, SONAR-10774, SONAR-10768).

 
Ann