[#2834] - REST v2 Running Reports Nullpointer

Category:
Bug report
Priority:
Normal
Status:
New
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

I am attempting to use the REST v2 framework to get an overview of reports that are currently running. As documented, I use the following URL to retrieve this list: http://<host>:<port>/jasperserver/rest_v2/reports?

This works fine.

However, as soon as I add filters to this URL the function stops working, eg: http://<host>:<port>/jasperserver/rest_v2/reports?reportURI=\reports\TestReport

The filters I have tested are reportURI and userName, but I assume this happens in any case. I have attached the full error trace. If you have any further questions, please let me know.

AttachmentSize
Plain text icon stack_trace.txt10.51 KB
v5.0.0
Thomas_J's picture
Joined: Jan 25 2013 - 7:57am
Last seen: 7 years 8 months ago

1 Comment:

#1
  • Assigned:nobody»

Some additional information:

I have had to implement these methods in the PHP Client myself, as they weren't implemented (for this reason?). I hope that these functions (or improvements on them) will be made available in future releases of the PHP Client. Unfortunately there is no project for the PHP Client, so I can't post this as a separate Feature Request. However, I hope that it is helpful for reproducing this issue.

/**
* This function retrieves all reports that are currently running.
* It returns a list of running reports along with the executionId's.
*
* @param string $uri - Filter by report URI
* @param string $user - Filter by owner of the report execution
* @return SimpleXMLElement - XML construct containing running reports and the executionIds
*/
public function getRunningReports($uri = null, $user = null)
{
// Construct the url
$url = $this->restUrl2 . REPORTS_BASE_URL . "?";
//TODO: Add the search parameters to the url (pending Jasper bug request #2834 - http://community.jaspersoft.com/jasperreports-library/issues/2834-1)
//$url = $this->restUrl2 . REPORTS_BASE_URL . '?' . http_build_query(array('reportURI' => $uri, 'userName' => $user));

// Send the request to the server
$data = $this->prepAndSend($url, array(200), 'GET', null, true);

// Return the data as XML element
$xml = new \SimpleXMLElement($data);
return $xml;
}

/**
* This function cancels a running report on the server.
* It echoes the cancelled status back in an xml response.
*
* @param string $executionId - The executionId of the report to cancel
* @return string - Confirmation of the cancellation
*/
public function cancelRunningReport($executionId)
{
// Construct the url and the page request body
$url = $this->restUrl2 . REPORTS_BASE_URL . "/$executionId/status";
$requestBody = '<status>cancelled</status>';

// Send the request to the server
$data = $this->prepAndSend($url, array(200), 'PUT', $requestBody, true);

// Return the raw response
return $data;
}

Feedback