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;
});
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: