Use Case:
Validating Mandatory Fields in REST Service Payload
Requirement:
The objective is to validate the mandatory fields received from the REST-exposed service. If any mandatory fields are missing, the payload should be rejected, and a custom fault should be thrown. This fault will then be handled in the global fault mechanism as per the defined business logic.
Implementation steps:
- After the trigger setup, take throw new fault activity and provide as following
- Code as "BUSINESS_ERROR"
- Reason as "Mandatory fields are missing from the request payload"
- Details: conat mandatory field names and request wrapper using get-content-as-string() function.
- Add skip condition : add for all the mandatory fields like channelid !='' etc
- In the global fault, define the business logic like here,
- we are sending the fault details to third party Saas software Datadog from there, it will emit alerts notification to desired support team
- Also, added a return action and send the error details to the caller or invoker of this service.
Detailed screenshots:
No comments:
Post a Comment