Skip to main content

API Methods

Temenos Explorer comes with a number of API methods that you can use for requests to APIs. These API methods use the Keycloak token meaning there is no additional authentication required.

You do not have to use the supplied API methods, but if you choose to implement your own you will also need to handle authentication and token refresh separately.

Includes

The Temenos Explorer API methods are included in /TemenosExplorer/public/bundle.js and this will need to be included in your plugin's index.html file.

Here is a code snippet that you can copy/paste into the <head> element of your plugin's index.html file using the correct relative paths:

<head>
<script src="../../bundle.js" defer></script>
</head>

Example

The following example shows how these methods can be used to make a call to an API and process the response:

// Define request parameters
const url = "http://my-api.temenos.com";
const httpHeader = {
"Content-Type" : "application/json"
};

// Make HTTP GET request
return JSONRequestDispatcher.apiGET(url, httpHeader)
.then((responseJson) => {
return responseJson;
})
.then((data) => {
return data;
})
.catch((err) => {
console.log('Caught API error:');
console.log(err);
});

async Functions

All API methods use the await operator and can therefore only be used within an async function.

JSONRequestDispatcher.nonApiGET()

Description

This method will request data from a file at the specified URL.

Parameters

ParameterTypeDescription
urlstringURL or path to a file containing the requested JSON data
customHttpHeadersobjectJSON object containing key value pair parameters to be added to the request header, use {} if not needed

Return Value

Promise

JSONRequestDispatcher.apiGET()

Description

This method will submit an HTTP GET request to the specifed URL.

Parameters

ParameterTypeDescription
urlstringThe URL for the request
customHttpHeadersobjectJSON object containing key value pair parameters to be added to the request header, use {} if not needed

Return Value

Promise

JSONRequestDispatcher.apiPUT()

Description

This method will submit an HTTP PUT request to the specifed URL.

Parameters

ParameterTypeDescription
urlstringThe URL for the request
customHttpHeadersobjectJSON object containing key value pair parameters to be added to the request header, use {} if not needed
requestEntityObjectobjectJSON object containing the request data to send

Return Value

Promise

JSONRequestDispatcher.apiPOST()

Description

This method will submit an HTTP POST request to the specifed URL.

Parameters

ParameterTypeDescription
urlstringThe URL for the request
customHttpHeadersobjectJSON object containing key value pair parameters to be added to the request header, use {} if not needed
requestEntityObjectobjectJSON object containing the request data to send

Return Value

Promise

JSONRequestDispatcher.apiDELETE()

Description

This method will submit an HTTP DELETE request to the specifed URL.

Parameters

ParameterTypeDescription
urlstringThe URL for the request
customHttpHeadersobjectJSON object containing key value pair parameters to be added to the request header, use {} if not needed
requestEntityObjectobjectJSON object containing the request data to send

Return Value

Promise