Jump to content

Get ReportsExecution details of reports via rest_v2, scheduled within JasperServer UI


Recommended Posts

Hi there,

I'm looking for a solution where I'm creating schedules in JasperServer UI, and I need to poll (on a scheduled basis) whether job was successful - report generated, or job failed.

In case of job failed, I'm recording the instance via a NodeJS app into my DB, and providing a capability to re-trigger these failed jobs.

I understand that there is already a support for restarting failed jobs - 

, but my requirement is also to track these separately.

I've tried reportsExecution Service and it does not return any content - 204.

Is there a way to achieve this?


Ravi Pandey

Link to comment
Share on other sites



in order to get a job status you can use the following API:


It will return the state descriptor of the job, for example:



Hope it helps


  • Thanks 1
Link to comment
Share on other sites

Thanks for your response @ddonofr, but this I've already tried:

 - get list of all jobs - http://<host>:<port>/jasperserver[-pro]/rest_v2/jobs?<arguments>

 - get each jobs details - http://<host>:<port>/jasperserver[-pro]/rest_v2/jobs/<jobID>

 - get each jobs state - http://<host>:<port>/jasperserver[-pro]/rest_v2/jobs/<jobID>/state

But this only tells us what happened with the job, and not whether report was generated when this job ran or not.


As a POC, I altered the code to throw error (created custom function) and used that in jrxml.

The error is successfully thrown for the report (when run via scheduler), and the report never generates.

Error - 



2023-11-20T17:03:00,257 ERROR SecureExceptionHandlerImpl,JasperServerScheduler_Worker-2:125 - There was an error on the server. Try again or contact site administrators. (Error UID: bd87d516-6488-4816-befe-5529d0439dba). Error evaluating expression for source text: CONVERT_TO_QUOTED_STRING($P{AgentName}) com.jaspersoft.jasperserver.api.JSException: Error filling report



Caused by: java.lang.IllegalArgumentException: Deliberately thrown error

at NSA_CFS_Reporting.CustomFunctions.CONVERT_TO_QUOTED_STRING(CustomFunctions.java:80)

at Rascher_1700407681143_653130.evaluate(Rascher_1700407681143_653130:109)

at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:313)

... 39 more


But the job still is in NORMAL state -


Jobs Status for jobId - 5344 successful! - {"previousFireTime":"2023-11-20T17:03:00+05:30","nextFireTime":"2023-11-20T17:08:00+05:30","value":"NORMAL"}

I want to know that when the job ran, was the report generated or was there any error?



Ravi Pandey

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...