Jump to content

Cannot check status of assync execution using rest_v2


felipegdr
Go to solution Solved by ssturdivant,

Recommended Posts

I'm trying to run an assync report using rest_v2. I'm using jasperserver 5.2, and I'm following the docs.

First I've used the reportExecutions service. I have sent a POST request to this url: http://<host>:<port>/jasperserver/rest_v2/reportExecutions   with the following content:

  "<reportExecutionRequest>"+  "   <reportUnitUri>/Testes/Fontes/Lista_Funcionarios</reportUnitUri>"+  "    <async>true</async>"+  "    <outputFormat>pdf</outputFormat>"+  "    <ignorePagination>false</ignorePagination>"+  "    <parameters>"+  "        <reportParameter name="_funcionario">"+  "            <value>11043</value>"+  "            <value>15658</value>"+  "        </reportParameter>"+  "    </parameters>"+  "</reportExecutionRequest>";[/code]

And I received the following response content:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportExecution><exports><export><id>pdf</id><status>execution</status></export></exports><reportURI>/Testes/Fontes/Lista_Funcionarios</reportURI><requestId>2096195791_1379503738825_5</requestId><status>ready</status><totalPages>1</totalPages></reportExecution>[/code]

So apparently everything is working thus far. 

 

The problem happens when I try to check the status of the execution by sending a GET request to the following url: http://<host>:<port>/jasperserver/rest_v2/reportExecutions/2096195791_1379503738825_5/status/   

I keep getting  an error message saying that the resource is not available:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><errorDescriptor><errorCode>resource.not.found</errorCode><message>Resource 2096195791_1379503738825_5 not found</message><parameters><parameter>2096195791_1379503738825_5</parameter></parameters></errorDescriptor>[/code]

 

 

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

This may happen if you aren't maintaining a session - your request to generate the report stores the report in the session, but your next request is a different session and so it cannot find the report.  You must use the login method to authenticate, and retreive the cookie sent with the response, and make sure to include it in all future requests.  This will persist your session and your report identifier will be valid.

Link to comment
Share on other sites

  • 5 years later...

@ssturdivant: wouldn't this mean nobody, other than the report requestor, can check report status via the API?

We have a problem where large reports are crashing jasper. Trying to sort out the best way to monitor long-running requests. On jasper 6.1, I can query the current reports via "/jasperserver-pro/rest_v2/reports" or "/jasperserver-pro/rest_v2/reportExecution". Both return the same information, an array of currently running reports with both report id & report uri.

When making a follow-up call (keeping jsessionid), I also get HTTP 204 / "No Content".

What would be the preferred method for a sensu monitor to obtain report details for a running report, so it could be correlated with date/time started, execution duration, etc.?

Link to comment
Share on other sites

  • 3 years later...

Hello, how can I maintain the session? for example how can I do it in postman where I am testing the functionality.

I am sending the request with the url, using basic authentication. and boom:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><errorDescriptor><errorCode>resource.not.found</errorCode><message>Resource /investigativo not found.</message><parameters><parameter>/investigativo</parameter></parameters></errorDescriptor>

 

investigativo is the name of the report.

 

Thanks in advanced.

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