Cannot check status of assync execution using rest_v2

1

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>";

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>

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>

felipegdr's picture
Joined: Apr 20 2012 - 3:51am
Last seen: 2 years 6 months ago

1 Answer:

0

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.

ssturdivant's picture
Joined: Oct 16 2013 - 1:04pm
Last seen: 3 years 11 months ago

Ok, that makes sense. I'm actually authenticating over and over again before every request. Thanks man

felipegdr - 5 years 9 months ago

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

ives.stoddard - 1 week 3 days ago
Feedback