objectAPI Configuration

The objectAPI can be configured using the restServiceConfig object.

The objectAPI configuration is set by passing the restServiceConfig object to the RestApiService.setRestServiceConfig function.

The restServiceConfig object is used to configure the following:

  • baseURL (String) - The REST API endpoint for all ActiveMatrix BPM services, with the exception of the L10NService and the RoleService (see the appsBaseUrl configuration below).
  • appsBaseUrl (String) - The REST API endpoint for WBPM services, which include the L10NService and the RoleService.
  • headers (JavaScript object) - These specify operating parameters of the service. There is a property name and value for each header. Some common headers are:
    • Authorization - The credentials for the call. For example:

      'Authorization': "Basic dGliY28tYWRtaW46c2VjcmV0"

    • Content-Type - The media type for the request body (for calls that use POST and PUT in the underlying REST API). For example:

      'Content-Type': "application/json"

    • Accept - The media type for the response from a call. For example:

      'Accept': "application/json"

  • corsEnabled (boolean) - This is currently not used.

The restServiceConfig object values can be set in one of two ways:

As a function that returns the value:

{
        getBaseUrl : getBaseUrlFunction,
        getAppsBaseUrl : getAppsBaseUrlFunction,
        getHeaders : getHeadersFunction,
        isCorsEnabled : isCorsEnabledFunction
}

Or, as a property that is set to the value:

{
       baseUrl : baseUrlString,
       appsBaseUrl : appsBaseUrlString,
       headers : headersObject,
       corsEnabled : corsEnabledBoolean
}

If both the function and value are set, the value returned from the function is used.

Examples

The following are examples of setting configuration values:

var getBaseUrl = function () {
    var baseUrl = 'http://<hostname>:<port>/bpm/rest';
    return baseUrl;
	};
var getHeaders = function() {
		return {'Authorization': "Basic dGliY28tYWRtaW46c2VjcmV0"};
	};
var isCorsEnabled = function() {
		return false;
	};