This library provides a client for the InetSoft web API.
$ npm install @inetsoft/api-client
By default, the library uses the Fetch API for communicating with the web service. If you require compatibility with older browsers, you will need to include a Fetch polyfill, such as this one. If you are using the client from Node.js, you will need to add the node-fetch package to your project.
Alternatively, you can implement HttpAdapter
and use any HTTP client implementation
you want. You can then pass an instance of your adapter to the createApiClient()
call.
You create an instance of the API client by calling the createApiClient()
function,
as shown below.
var client = createApiClient('http://localhost:8080/sree', 'apiAccount', 'password');
client.report.getReports().then(addReports);
function addReports(reports) {
// do something with the reports
}
Note that when using in a web page, the page must be served from the same domain as the InetSoft application or you must add the appropriate CORS HTTP headers.
Using in TypeScript is similar, as shown in the following example.
import { createApiClient } from '@inetsoft/api-client';
const client = crateApiClient('http://localhost:8080/sree', 'apiAccount', 'password');
client.report.getReports().then(reports => {
reports.forEach(report => {
// do something with the report
});
});
Further information on the client APIs can be found in the API documentation.
The following table lists the compatibility between versions of this library and the InetSoft product version.
API Version | Product Version |
---|---|
1.0.0 | 2019 |
The InetSoft JavaScript API Client library is licensed under the Apache License 2.0.
the base URL of the InetSoft server.
the user name used to authenticate with the server. This parameter is not required if anonymous access is allowed or if the user is already authenticated in the enclosing web page.
the password used to authenticate with the server.
the adapter for the HTTP client. If not specified, this will use the fetch API.
an new API client instance.
Generated using TypeDoc
Creates a new instance of ApiClient.