The Decision API accelerates the integration process with Swagger documentation for all your decision and rule set endpoints organized by their respective rule application. This paired with a simplified request and response model, dramatically reduces the time it takes to test and integrate your decisions and rules.
Decision API EndPoints
The Decision API provides the following base endpoints to execute decisions and rules. All HTTP methods are POST.
Execute decision
/api/{ruleAppName}/decision/{decisionName}
- e.g. /api/MortgageCalculator/decision/CalculatePaymentSummary
Execute rule set
/api/{ruleAppName}/{entityName}/execute/{ruleSetName}
- e.g. /api/MortgageCalculator/Mortgage/execute/PaymentSummaryRules
Apply rules
/api/{ruleAppName}/{entityName}/apply
- e.g. /api/MortgageCalculator/LoanInfo/apply
A significant improvement of the Decision API over the classic Rule Execution API is that the request body no longer requires a complex JSON object. The body payload of the Decision API expects only the decision input or entity data as defined in the rule application. The same applies to the response body. This model conforms to what is traditionally expected from an API and diffuses the complexity that can create barriers to adoption.
While the Decision API has endpoints for both decisions and rules, it is advantageous to use the decision endpoint when calling from your application. This allows you to define separate input and output data contracts for the request and response which can better align to your application needs.
Executing Decisions and Rules Using Swagger
Executing your decisions and rule sets from the Swagger documentation is a straightforward process that can be performed by either using the default Swagger page or by selecting a rule application from the dropdown. The default Swagger page can be thought of as a template that the rule application-specific endpoints are built from. By selecting a rule application, you will be presented with everything needed to call the API including the data contract specific to its decisions and rule sets.
It is not required to use the Authorize button when testing with Swagger from the InRule Portal, since it inherits from the portal authorization.
Request Body
When selecting a decision or rule set, the body parameter will display the relevant request input and response output data models. You can then select Try it out to replace the default values with your test data and execute the request.
Response Body
Once the request has been executed by selecting the Execute button, the response body and return code will be available in the Swagger response section. From here, you can inspect the response from the Decision API and verify that the execution output is correct.
Comments
0 comments
Please sign in to leave a comment.