Home

CognosApi.js

CognosApi class provides an client API framework for developing applications using IBM Cognos Analytics components as a service. CognosApi class is the root level API. Once the CognosApi is initialized, it provides an entry point to all service APIs where developers can have direct access to rich features of IBM Cognos Analytics components.
Multiple instances of the CognosApi class can be instantiated if the client application wishes to access more than one services (or the same service in multiple instances).

As a prerequisite, CognosApi requires a Promise library. Although most modern (ECMAScript 6 compatible) browsers do support Promise, It is recommended to load a Promise library (ie. Bluebird) to extend the compatibility of the application.

License:
  • Licensed Materials - Property of IBM

Example

// Create an instance of the CognosApi by providing the IBM Cognos Analytics root URL
// and the DOM node of the container DIV
const cognosApi = new CognosApi({
	cognosRootURL: 'http://localhost/bi/',
	node: document.getElementById('containerDivId'),
	language: 'en'
});

// initialize the CognosApi in order to obtain the service APIs
cognosApi.initialize().then(() => {
	cognosApi.dashboard.createNew();
	...
});
...

// Ensure to close API at the end
cognosApi.close();