# Decision Engine Endpoints The Decision Engine Suite provides a set of endpoints to: - Authenticate - Retrieve Available Decision Trees and User Input Fields - Run a Decision Tree - Return / Update a Decision Below is a flow diagram guide on how to use these endpoints effectively. ## Flow Diagram ```mermaid %%{ init: { "theme": "default" } }%% flowchart TB %% Stage 2 subgraph Stage-2 K[Get Specific Instance] L[Update Specific Instance] M{Customize Outcome Values?} N[Get Outcome Values] O[Update Outcome Values] end %% Stage 1 subgraph Stage-1 A[Authenticate] B[Retrieve All Instances Available] C[Retrieve User Data Fields Of a Instance] D{Run Decision?} E[Make Decision Request] F[Retrieve Decision Response] G[Retrieve Decision Log History] H[Retrieve Specific Decision Log] I[Update Specific Decision Log] J{Update Instance Configuration?} end %% Stage-1 Flow A --> B --> C --> D D -- Yes --> E --> F --> G --> H --> I D -- No --> J %% Stage-2 Flow J -- Yes --> K --> L --> M M -- Yes --> N --> O M -- No --> C O --> C %% Force straight lines (index starts from 0) linkStyle 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 stroke:#000,stroke-width:1px ``` ## 1. Authenticate Before using any of the endpoints, you must authenticate. This ensures you have the necessary permissions to access the data. ### Example Request ```http POST /authenticate ``` ## 2. Retrieve All Available Decision Trees This endpoint returns all the available decision trees that you (the logged-in user) can run. These trees are assigned by your account manager. You can filter the results using the parameters listed in the API documentation. ### Example Request ```http GET /decisionEngine/GUID ``` ### Response Object The response will produce a list of GUID's along with their friendly name for ease of identification. It will be the `GUID` required for the Decision Tree you wish to run on the next endpoint. IMPORTANT The GUID in the response is the `provenirId` required in the path variables for the subsequent endpoints. ## 3. User Data Fields This endpoint returns the fields required in the `requestBody` for the selected `Decision Tree` to be run in the `Run Decision Tree` Endpoint. ### Example Request ```http GET /decisionEngine/{provenirId}/userDataFields ``` This endpoint will show the criteria that will need to be applied to check. These templates are predefined but can be adjusted. (Refer to the 'Edit Predefined Decision Trees' section for more details.) ## 4. Run Decision Tree This allows you to run the selected tree against the identified company. You need to supply the {provenirId} in the path. > **NOTE:** The {provenirId} is the GUID in the response from the endpoint in step 2. Not all GUIDs require a requestBody. It is essential to query the endpoint in step 3 to determine the required requestBody for this request. ### Example Request ```http POST /decisionEngine/{provenirId} ``` ## 5. Return Decision Outcome This endpoint retrieves the result of the decision tree submission. It must also be called if any manual changes are made to ensure the updates take effect. ```http GET /decisionEngine/decisionOutcome/{guid} ``` ### Example Response ```json { "correlationId": "23921650-c073-11ea-860f-06bc8182190e", "includeInManualReview": true, "decisionOutcomes": { "items": [ { "status": 1, "label": "Accepted", "description": "The decision has met all the required criteria and has been automatically accepted." } ] } } ```