Hello,
I am an intern and I've only been working with JasperServer for a short amount of time, so please forgive me if I confuse terminology or say something stupid.
I have a Java app that uses the REST API to test our reports. It simply executes them and checks for http 200 status.
We want to do the same thing for the ad hoc views we have, but apparently it wasn't possible when they first created the app.
I'm wondering if it is now possible with the new REST API and if so, what classes should I be looking to use?
For reports, we currently use this:
OperationResult<ClientResourceListWrapper> resultReport = client .authenticate(jasperusername, jasperpassword) .resourcesService() .resources() .parameter(ResourceSearchParameter.FOLDER_URI, folder) .parameter(ResourceSearchParameter.TYPE,"ReportUnit") .parameter(ResourceSearchParameter.RECURSIVE, "true") .search(); ClientResourceListWrapper reportResourceListWrapper = resultReport.getEntity(); OperationResult<InputStream> reportrun = client .authenticate(jasperusername, jasperpassword) .reportingService() .report(cs.getUri()) .prepareForRun(ReportOutputFormat.HTML, 1) .run(); // InputStream report = reportrun.getEntity(); int responsestatus=reportrun.getResponse().getStatus();
I can't get it to work by using .parameter(ResourceSearchParameter.TYPE,"AdhocDataView") or .parameter(ResourceSearchParameter.TYPE,"AdhocReportUnit").
For AdhocDataView, I get an error: invalid value for reportURI parameter.
For AdhocReportUnit, I get a null pointer exception.
Any advice is greatly appreciated. Thank you!
1 Answer:
Unfortunatetly ad-hoc views can not be consumed via any REST or Visualize.js API - you will have to instead embed them in an iFrame, some of that is discussed on this wiki page: http://community.jaspersoft.com/wiki/embedding-ad-hoc-http-api