The System API is for low-level processes. System API sits on top of legacy system or Database or any other system which provide actual data to the API.
Idealy System API should the deal with System related functionality or low level functionality.
In this Demo, the "import-csv-system-api" (System API) received the JSON input from the Process API, and it will validate the content one by one with the Mule validator.
If any validation fails, the API will get the actual reason for the validation and reject the flow and pass the reason to the Experience API through the Process API.
If the validation of all the content succeeds, process the data for the database to insert/update the record and respond back to Process API.
Step 10 : Define the RAML in "import-csv-system-api".
Step 11 : To generate the flow, right-click on the api.raml file and choose "Mule -> Generate Flows from REST API".
Step 12 : It generates api.xml and add flows. After generate the flows by API kit router, add flow reference to process low level functionality (i.e Validate the input content and store in Database).
Step 13 : Define subflow("process-file") and its logic in api-impl.xml to perform low level logic, (i.e. Validate the input content and store in Database).
NOTE : In the System API I haven't confired the DB connector. But, if you wish you can do that and persist the JSON content.
Step 14 : CustomValidationException.java - This custom exception class lets you catch the exception thrown by the validator flow.
Comments