Reviewing REST API integration
The BIRT iHub server offers many RESTful URI endpoints to access stored resources on the server. This example uses JavaScript to make the following REST API requests:
*Authenticate the user to receive an authentication ID to attach to other REST API requests.
*Download a list of locations that are used to build BIRT reports.
*Download visualizations for display in HTML DIV tags.
The application sends the RESTful URI request to the iHub server using services.js. The metadata collected using the REST API includes the timestamp when the BIRT document was created. JavaScript uses this value to check if the data is older than the report_refresh_Time value, located in main.js. If the data is older the report is executed to refresh the data.
The following REST API operations are used in BIRT Aviatio:
*/Login to return an authId for an authenticated user.
*/Files to retrieve a file id by searching for the file name.
*/Visuals to execute a BIRT design file.
*/Dataobject to extract values from a data set in a selected data store file.
The main JavaScript functions used in the application are organized into the following files:
*controller.js contains JavaScript functions to log in, load visualizations, and run reports.
*factory.js generates requests to each RESTful service the application uses.
*main.js library builds RESTful URIs to access resources on the iHub server.
*services.js is a template for RESTful HTTP requests.