Corticon supplies a REST API that lets client applications execute against remote Decision Services.

REST API online documentation—The REST API in static format is available in Java Server's install directory for Java and .NET at C:/Progress/Corticon%207.1/Server/RESTDoc/index.html (but not propagated to the IIS Server), and at https://documentation.progress.com/output/Corticon/7.3/RESTDoc/

application/json

The payload set to the REST API is a JSON object that contains the Decision Service and related data to execute against. The format of the JSON object is:
{
  "name": <string>,
  "majorVersion":<number - optional>,
  "minorVersion": <number - optional>,
  "Objects": <JSONArray of JSONObjects>
}

where name, majorVersion, and minorVersion values specify which Decision Service will be used for the execution, and the Objects value is the payload of the data to be processed.

Note: Parameters—Other optional parameters can be added before Objects:
#enableRuleTrace 
#restrictInfoRuleMessages
#restrictWarningRuleMessages 
#restrictViolationRuleMessages 
#restrictResponseToRuleMessagesOnly 
#locale 
#timezoneId 
On the Corticon Server, you can use REST to execute a JSON-formatted Corticon Request by specifying the target Decision Service. The REST method supported is HTTP POST in the form:
HTTP POST:base/axis/corticon/execute
where base is the Corticon Server's IP or DNS-resolvable name and port.

Native JSON

You can use simplified JSON by adding the appropriate decision service name and version parameters in the request URL:


curl -X 'POST' \
'http://localhost:8080/axis/corticon/execute/nativejson?name=MyAdvancedTutorial&majorVersion=1&minorVersion=1'
					\
 -H 'accept: */*' \
 -d '{
Note: Parameters—Other optional parameters can be added to the header:
#enableRuleTrace 
#restrictInfoRuleMessages
#restrictWarningRuleMessages 
#restrictViolationRuleMessages 
#restrictResponseToRuleMessagesOnly 
#locale 
#timezoneId 

List the request payload without metadata tags:

{
	        "preferredCard": {
            "cumulativeCashBack": 9.24,
            "cardNumber": "12"
        },
        "ShoppingCart": {
            "totalAmount": null,
            "Item": [
                {
                    "price": 55,
                    "name": "Filet Mignon",
                    "department": null,
                    "barCode": "39-280-12345"
                },
                {
                    "price": 14.99,
                    "name": "Beach Towel",
                    "department": null,
                    "barCode": "32-300-23456"
                },
                {
                    "price": 12.5,
                    "name": "Ginger Ale Case",
                    "department": null,
                    "barCode": "32-285-34567"
                }
            ],
            "useCashBack": true,
            "savings": null
        },
        "Name": ""
  
}

Root Entities in the Decision Service package

Where the root entity is not specified and must be inferred, you can save processing time by setting the Root Entities field on the Ruleflow while packaging, as illustrated:


application/xml

A REST call can handle XML when the XML-formatted request is identified in the request header as application/xml. Then, the format of the XML object is:

Success and error responses

The response returned by the server has two parts:
  • A HTTP status code
  • An HTTP header containing message execution info

Success response - In addition to the processed request, when execution is successful, the response message's body contains the updated JSON string. A successful execution's shows its status (200) and header.

Error behavior

For all REST executions, an error (an HTTP status code other than 200) provides messages in the response body.

Example:


 
            	
{"error": {

"type": "com.corticon.eclipse.rest.delegates.CcRestDelegateRequestErrorException",
"message": "retrieveServiceProperties(String,String,String) 
           Could not find decision service: \"Process Order \"",
"cause":{
"stackTrace": [...],

"type": "com.corticon.service.ccserver.exception.CcServerDecisionServiceNotRegisteredException",
"message": "CcServer.lookupCcServerPoolHighestVersionNumber() 
           Decision Service: Process Order is not registered. Update failed."},
"stackTrace": [...],"parentError": {"stackTrace": [...],

"type": "com.corticon.service.ccserver.exception.CcServerDecisionServiceNotRegisteredException",
"message": "CcServer.lookupCcServerPoolHighestVersionNumber() 
           Decision Service: Process Order is not registered. Update failed."}}}