Use cURL to download a report from Pentaho BA server

Image of Pentaho logo on blue sparkling background

The Pentaho Business Analytics (BA) server is a production level application for storing, scheduling, creating and running all the Pentaho report types through your web-browser. But sometimes, you need to work on the commandline and put things precisely where you want them. If you want to run and download a Pentaho Report Designer pixel-perfect report (a PRPT) from a secured server, you can use the cURL command-line utility – available for all leading Operating Systems  ( download it from here ). A note about the URL addressing in Pentaho BA Server.  The actual repository path to the report will contain special characters which need to be converted to an HTML entity. So the path /home/acave/Employee Timesheets.prpt would convert to %3Ahome%3Aacave%3AEmployee%20Timesheets.prpt   You can even pass parameters or change the output format to PDF, RTF or CSV

(Note:  these commands should be on a single line, but I’ve had to split them across multiple lines for readability.

Unix uses the backslash character to indicate a line continuation (\), but Windows uses a carat (^), so you might need to replace them. )

— as a PDF

curl -u"acave:mypassword)" \

"http://<serveraddress>:80/pentaho/api/repos/%3Ahome%3Aacave%3AEmployee%20Timesheets.prpt/\

generatedContent?Select%20Site=SYD&Select%20Date=2018-03-14&output-target=pageable/pdf" \

-o ~/timesheets.pdf

— as an RTF document

curl -u"acave:mypassword)" \

"http://<serveraddress>:80/pentaho/api/repos/%3Ahome%3Aacave%3AEmployee%20Timesheets.prpt/\

generatedContent?Select%20Site=SYD&Select%20Date=2018-03-14&output-target=table/rtf" \

-o ~/timesheets.rtf

— as a CSV

curl -u"acave:mypassword)" \

"http://<serveraddress>:80/pentaho/api/repos/%3Ahome%3Aacave%3AEmployee%20Timesheets.prpt/\

generatedContent?Select%20Site=SYD&Select%20Date=2018-03-14&output-target=table/csv;page-mode=stream" \

-o ~/timesheets.csv

You might use the report as input to another process, or to push reports to a very particular setup that you might have (that Pentaho BA doesn’t support) In addition, as PRPT reports can use a set of Pentaho Data integration ETLs as a data source, you can set off a whole set of complex extractions and transformations to get your report data (e.g. joining data from a file log to a database table and an RSS feed). Pentaho is very flexible. Good luck.

Portrait of Maxx Silver
Andrew Cave

Andrew Cave is a senior data engineer with BizCubed. He has worked in network data, billing, telco credit and debt after a career in the welfare sector. He loves databases. Follow him on LinkedIn

More blog posts

ESG Reporting Nirvana Now Within Reach

BizCubed launches ESG123 – An advanced data engineering services suite designed to streamline reporting compliance and enable sustainability teams to turn ESG into a strategic advantage. BizCubed, a...

read more