CTA-K12 / JasperClient

Jasper Reports Server REST API Client for php
Other
1 stars 0 forks source link

Output exportIDs identified by UUID, not format name #1

Open databoy opened 10 years ago

databoy commented 10 years ago

Thanks so much for making this available! It's saving hours of work, I'm sure!

According to the API docs at https://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v56/requesting-report-output has the following API URI:

http://<host>:<port>/jasperserver[-pro]/rest_v2/reportExecutions/requestID/exports/exportID/outputResource

Where the exportID is returned by the execDetails.

However, line 327 has: $formats = (isset($options['formats']) && is_array($options['formats'])) ? $options['formats'] : array('pdf', 'html', 'xls');

And the $formats array is used: foreach($formats as $format) { $output[$format] = $this->getExecutedReport($requestId, $format); }

But the URI for the getExecutedReport() method uses the $format in place of the $exportID mentioned above:

$resp = $this->rest->get(JasperHelper::url("/jasperserver/rest_v2/reportExecutions/{$requestId}/exports/{$format}/outputResource"));

I was able to get this to work by iterating over the $execDetail->exports->export simpleXML object and getting the formats and IDs from that...

databoy commented 10 years ago

I encountered a similar issue (and fixed it with a similar approach) regarding attachments.

Again, thanks! Please let me know if the solution is counter to your approach, or if there is a different solution...

tyhand commented 10 years ago

It appears that jasper changed their api from 5.5 to 5.6. In 5.5 the export id was essentially a text name for the export type, but in 5.6 it appears that the export id is not something else. I am running and testing with version 5.5, and (incorrectly) making the assumption that the api would not change much between 5.5 and 5.6. Knowing that now, I'm going to go back and try add support for both versions.

tyhand commented 10 years ago

I've gone ahead and added support for 5.6 in both the client and the bundle. It should solve this issue, and I'm testing as to whether it solves the others.

To use the 5.6 code, change the report bundle part of the config.yml to something like the following:

mesd_jasper_report:
    version: 5.6
   # ... all the other original config options for the report bundle