Jump to content
We've recently updated our Privacy Statement, available here ×

Can I run a report from Reportserver, using command line


graham.smith

Recommended Posts

I have just built my first report in Studio 6.6.0, and successfully published it to the report server.  I can run the report from within both the Studio and ReportServer GUIs, but I'd like to be able to run the report from a .BAT or Powershell script running on the same server as ReportServer, and get it to put the report output to a PDF file.  I found a few forum entries asking the same question - but none have a recent answer, and I couldn't really follow the answers I did find.  I am somewhat new to the world of Java, Apache and Tomcat - so if some aspect of these is required to allow me to run a report using commandline, then please lead me gently through the process. I have downloaded the jasperreports-6.6.0-project.zip file, which some say tells me everything I need to know - but I don't know where to start among the 60MB+ of content there either.

Many thanks in advance

Graham

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I do not know of a cmd function methods that would do this for you. 
What you could do is make use of the jasper server api and make a url call via cmd line. You can run scripts that do this. 
So either you direct report request via https://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/v2reportexecutions-service

Or you can create a schedule job on server of via rest api call, that outputs pdf etc. or emails the reports if you wish and then just call the job to run immeditaly via rest call, via cmd line. 
https://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/v2jobs-service

That what I would have done. 
You could write your own small program that you can deploy on your os and just call it via cmd line and pass parameters that would be used to make a url call with method and payload(where required) 

I would have implemented, 1 of the 2 above, if limited to cmd line request.

Link to comment
Share on other sites

Just use the REST APIs to generate a report in PDF format. You'll be able to get the report in the web browser just by enterin the url to the report. If you can get the report in the web browser, just use that url in the Windows's start command. (start <url to report>)

https://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/running-report

Link to comment
Share on other sites

Thanks Hozawa - I think that your answer is probably the same as the first half of joseng62's.  I am limited to running this report from a commandline (including passing it parameters), and then saving it as a PDF file, which I then need to email to someone (also from commandline or scripting), and the whole job is an automated hands-off function that is triggered when a fire alarm goes off.

Joseng62 - I haven't followed your links through fully yet, but from your description, it sounds like kind of solution I need... a script that accepts appropriate parameters, and includes all the REST API calls to execute the report.  Perhaps I can make a generic script to allow the call of ANY report with ANY parameters to make it more flexible.

Many thanks both, for taking the time to reply.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...