Integrating REST API and JSAPI into an application
The REST API supports creating a visualization from a report design based on user input. Available formats for the visualization are Adobe PDF, Microsoft Excel, and BIRT report document. A specific viewer opens each visualization type. Typically, the browser opens PDF files in a PDF viewer and Excel spreadsheets in Microsoft Excel.
To open and interact with a report document, an application uses Actuate JavaScript API (JSAPI). To access the JSAPI viewer, deploy the HTML page using REST API and JSAPI code to an application server. JSAPI provides the viewer, which supports report navigation and interactivity, as the actuate.Viewer class, as shown in Figure 15‑7.
Figure 15‑7 Report document in the JSAPI viewer
The REST API provides a report document to a JSAPI viewer using two supported methods:
*REST API accesses an existing report document in the iHub volume.
REST API passes the full path of the report document to the JSAPI viewer. Use the following JSAPI syntax to view the temporary report document in the BIRT viewer:
viewer.setReportName( "<Path>/<Name>.rptdocument" );
*REST API executes a report design immediately, creating a temporary report document.
The POST visuals/{visualId}/execute REST API resource creates a temporary report document. The response includes an object ID number and a connection handle to access the temporary file. The iHub volume locates the temporary report document in a folder used only for these documents. Use the following JSAPI syntax to view the temporary report document in the BIRT viewer:
"/$$$Transient/<ObjectId>.rptdocument", "<connectionHandle>" );
Report designs often have parameters that filter or alter the output. To set parameter values for a POST visuals/{visualId}/execute request, use a JSON-formatted string of name‑value pairs in the paramValues input parameter.
In both cases, call the JSAPI actuate.load( ) method to load the JSAPI viewer classes. Then, specify the JSAPI connection to the iHub volume using an actuate.RequestOptions object. This object uses the authId authentication token returned by a POST login operation to authenticate the JSAPI session. Pass the RequestOptions object to the actuate.initialize( ) JSAPI method. Use a callback method on initialize to open the viewer or a separate function.
For information on how to use the JSAPI, see Creating a custom web page using the Actuate JavaScript API.