# Sonatype Data Backup

**URL:** <https://community.sonatype.com/t/sonatype-data-backup/3261>\
**Category:** Sonatype Lifecycle & Firewall\
**Created:** [January 10, 2020, 8:31am UTC](https://community.sonatype.com/t/sonatype-data-backup/3261 "2020-01-10T08:31:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srayate](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@srayate](https://community.sonatype.com/u/srayate)\
**Post date:** [January 10, 2020, 8:31am UTC](https://community.sonatype.com/t/sonatype-data-backup/3261/1 "2020-01-10T08:31:50Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![andres](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/andres/32/201_2.png) [@andres](https://community.sonatype.com/u/andres)\
**Post date:** [January 10, 2020, 2:30pm UTC](https://community.sonatype.com/t/sonatype-data-backup/3261/2 "2020-01-10T14:30:52Z")

</div>

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:

- [Application](https://help.sonatype.com/iqserver/automating/rest-apis/application-rest-apis---v2)
- [Report-Related](https://help.sonatype.com/iqserver/automating/rest-apis/report-related-rest-apis---v2)

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:

> **[GitHub - sonatype-nexus-community/gonexus: Go API for provisioning and interacting with...](https://github.com/sonatype-nexus-community/gonexus)**
>
> Go API for provisioning and interacting with Sonatype's Nexus Repository Manager and Nexus IQ Server

Specifically, the [GetAllReports(iq nexusiq.IQ)](https://godoc.org/github.com/sonatype-nexus-community/gonexus/iq#GetAllReports) method will just give you a list of all reports in your IQ instance. You can then use the [ReportPdfURL](https://godoc.org/github.com/sonatype-nexus-community/gonexus/iq#ReportInfo) field to download the PDFs.

Edit: I went ahead and created a simple go app which uses the [gonexus library](https://github.com/sonatype-nexus-community/gonexus) to download all PDFs.

Here is the gist:

> <https://gist.github.com/HokieGeek/3a3aaa453ade5fd79a52004bb5f47969>
