DataConnectors.createRESTDataConnector

Creates a RESTful Data Connector constructed with a base URI that provides the following functionality:
  • Direct communication with a REST service without having to call com.ebasetech.xi.services.RestServices API helper functions.
  • Customisable headers are sent with all REST calls.
  • Authentication can be sent with all REST calls.
  • Error handling for typical HTTP error codes.
  • Response handling for Data Connector REST calls.

The com.ebasetech.xi.api.connectors.RESTDataConnector is constructed with a base URI that is used to construct calls to a specific endpoint when calling the appropriate RESTful web service call.

The HTTP header Content-Type: application/json is set as default. This can be overridden by calling the com.ebasetech.xi.api.connectors.RESTDataConnector#setDefaultHeader(String, Object) function.

Further documentation.

JavaScript example:

 const restDataConnector = connectors.createRESTDataConnector("https://jukeboxapi.example.com/");
 // Build the URI for the /playlists endpoint
 const uri = restDataConnector.get("playlists");

 // Call the endpoint using the HTTP GET method
 var response = restDataConnector.get(uri);

 // Iterate through the playlists array in the response object
 response.playlists.forEach(function(playlist) {
    tables.playlists.insertRow();
    tables.playlists.name.value = playlist.playlist_name;
 });
 

returns RESTDataConnector

Parameters

java.lang.String  baseUri,