Sonatype Data Backup

Hi All,

Is there a way to take all application data backup (Generate pdf option in Application report) via single click/run instead of downloading all applications pdf individually.
Thanks in advance!

Welcome to the Community, Sukrut!

There is no single-click solution, but you can make use of our REST API to get the PDF download URL. The endpoints you need are:

Specifically, follow these steps:

  1. Get a list of all of the applications in your IQ server with an HTTP GET to /api/v2/applications
  2. For each application, use its internal ID to get their reports with an HTTP GET to /api/v2/reports/applications/{applicationInternalid}

You will get an array with one report object for each stage (build, stage-release, release) which will look a bit like this:

[{
“stage”: “build”,
“applicationId”: “4537e6fe68c24dd5ac83efd97d4fc2f4”,
“evaluationDate”: “2015-01-16T13:14:32.139-05:00”,
“latestReportHtmlUrl”: “ui/links/application/Test123/latestReport/build”,
“reportHtmlUrl”: “ui/links/application/Test123/report/474ca07881554f8fbec168ec25d9616a”,
“embeddableReportHtmlUrl”: “ui/links/application/Test123/report/474ca07881554f8fbec168ec25d9616a/embeddable”,
“reportPdfUrl”: “ui/links/application/Test123/report/474ca07881554f8fbec168ec25d9616a/pdf”,
“reportDataUrl”: “api/v2/applications/Test123/reports/474ca07881554f8fbec168ec25d9616a”
}]

You want reportPdfUrl to get the URL you want, and then download the PDF.

There is also a community-supported go library which can ease some of this effort:

Specifically, the GetAllReports(iq nexusiq.IQ) method will just give you a list of all reports in your IQ instance. You can then use the ReportPdfURL field to download the PDFs.

Edit: I went ahead and created a simple go app which uses the gonexus library to download all PDFs.

Here is the gist: