Possible to execute saved ad hoc views with REST client?


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)
                .parameter(ResourceSearchParameter.FOLDER_URI, folder)
                .parameter(ResourceSearchParameter.RECURSIVE, "true")
        ClientResourceListWrapper reportResourceListWrapper = resultReport.getEntity();
OperationResult<InputStream> reportrun = client
                    .authenticate(jasperusername, jasperpassword)
                    .prepareForRun(ReportOutputFormat.HTML, 1)
        //    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!

atotheroh's picture
Joined: May 15 2015 - 3:25pm
Last seen: 7 years 7 months ago

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

ernestoo's picture
Joined: Nov 29 2010 - 11:59am
Last seen: 5 years 7 months ago