Getting Data In

Can I Export PDF Via Rest?

mzorzi
Splunk Employee
Splunk Employee

Is it possible to download the report in PDF format via REST?

Tags (2)

mzorzi
Splunk Employee
Splunk Employee

Try this :

curl -u admin:{{password}} -k 'https://localhost:8089/services/pdfgen/render?input-dashboard={{your_dashboard}}&namespace={{your_namespace}}&paper-size=a4-landscape' >> test.pdf

damode
Motivator

This command works for dashboards that dont require any user input.

How can we use the above to command to export a dashboard that requires user inputs ?

I tried the above command to export the Splunk for PaloAlto Networks app's main dashboard and it worked. However, when I tried the same command with additional parameters for Cisco app's dashboard, it just generated an unreadable1kb pdf file.

Example below,
curl -u admin:{password} -k "https://localhost:8089/services/pdfgen/render?input-dashboard=CiscoNetworksOverview&namespace=cisco_..." >> C:\Users\admin\Downloads\test.pdf

Any workaround for this please?

0 Karma

migquinn
Engager

When I try using this method, a .pdf file gets pulled back but isn't readable and won't open. Have you guys encountered this issue?

0 Karma

Chinna_nara
New Member

sometimes not able to open the pdf report, it's corrupted and it is from cluster environment. Any views on it?

0 Karma

anwarmian
Communicator

You can write a python script to input data to a generic dashboard and create a pdf. Please see the following link.

https://answers.splunk.com/answers/366832/generate-pdf-from-view-in-rest-api.html

It worked for me.

0 Karma

bruceclarke
Contributor

One thing I noted is that the line endings were causing an issue for Adobe to read the PDF. If anyone is having that issue, replacing any new line characters ("\n") with carriage returns ("\r") should fix the issue.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...