Overview

Decision Center exposes a REST API that you can use to build, test, and deploy decision services. With this REST API, you can easily set up and enforce a continuous deployment process by using the programming language of your choice.

You can use the end points provided by the REST API to carry out your tasks, such as:
  • Retrieve the decision services of your repository, their branches, deployment configurations, and test suites.
  • Retrieve the list of servers available.
  • Build, download, or deploy a RuleApp for a deployment configuration.
  • Run a test suite.
  • Import and export decision services.
  • Manage decision services that use the decision governance framework.
  • View the contents of your repository.

Restrictions based on user roles and permissions also apply to the Decision Center REST API. See Decision Center groups of users.

For example, use the following command:
curl http://localhost:9090/decisioncenter-api/v1/decisionservices --user rtsAdmin:rtsAdmin
This command returns a JSON object such as:
{
  "elements": [
    {
      "id": "77072920-2ec3-11db-bb3d-a34db576b043",
      "internalId": "brm.RuleProject:1:1",
      "name": "miniloan-rules",
      "buildMode": "DecisionEngine"
    },
    {
      "id": "4d9b5dc7-8a7e-404d-a05d-59023707c7d9",
      "internalId": "brm.RuleProject:2:2",
      "name": "AutoQuote",
      "buildMode": "DecisionEngine"
    }
  ],
  "totalCount": 2,
  "number": 0,
  "size": 2
}

Packaging and deployment

On Liberty profile and Tomcat application servers, the REST API is bundled as a stand-alone web application (WAR file) that can be deployed independently from the Business console and Enterprise console. For more information, see Deploying the Decision Center WAR files on Liberty profile, or Deploying the Decision Center WAR files on Tomcat.

If you are using another application server, such as WebSphere® Application Server, the REST API is deployed when the Decision Center EAR file is deployed.

This web application is completely stateless and can be deployed behind a load balancer for scalability and reliability purposes, without any session affinity. When it is deployed, you can access the Swagger user interface at http://localhost:<port_number>/decisioncenter-api. This interface exposes a view of the available endpoints, their documentation, and a Try it out button to test each endpoint.

Authentication

All endpoints, except /about, require authentication. You can use basic authentication by entering your Decision Center user name and password. For example:
curl http://localhost:9090/decisioncenter-api/v1/decisionservices --user rtsAdmin:rtsAdmin
As an alternative, and to avoid providing a clear password in your scripts, you can also connect by using a token that you can generate through the /token(POST) endpoint, for example:
token=`curl -X POST --user dcAdmin:dcAdmin 'http://localhost:9090/decisioncenter-api/v1/token?appName=MyAppd&date=2020-09-13T10%3A48%3A32.698%2B0000'
`curl 'http://localhost:9090/decisioncenter-api/v1/decisionservices --header "Authorization: Bearer ${token}"

When you use the token, you must enter the keyword Bearer before you provide the token.

To cancel a token, you can either provide an expiration date when you generate the token, or revoke the token at any time by using the /token(DELETE) endpoint.

Note: In the Swagger user interface, you might see a Image shows warning icon warning icon in some of the REST API methods. When you click this warning, a window opens asking for your login credentials. If you are authenticated to the server, you do not need to authenticate again, and you can disregard this warning.

Errors

Conventional HTTP response codes are used to indicate the success or failure of an API request. When an error occurs, the body of the HTTP response always contains a JSON error object with an error code, a reason, and a reference. For example:
{
  "error": "IlrConnectException",
  "reason": "Could not look up datasource named 'mydatasource'",
  "status": "BAD_REQUEST",
  "details": [
    "Could not look up datasource named 'mydatasource'",
    "Name [mydatasource] is not bound in this Context. Unable to find [mydatasource]."
  ]
}

Filtering and pagination

Explore methods that return collections of objects, such as /decisionservices, can be paginated. By default, all elements of the collection are returned, but you can specify a page size and a page number to retrieve only a subset of the collection. For example:
curl http://localhost:9090/decisioncenter-api/v1/decisionservices?page=2&size=20 --user rtsAdmin:rtsAdmin
You can also filter returned objects by their property, by using the q parameter:
curl http://localhost:9090/decisioncenter-api/v1/decisionservices?q=name:AutoQuote --user rtsAdmin:rtsAdmin