Tuesday, November 26, 2024

OIC - Input Validation: Ensuring Mandatory Fields Are Filled, else reject the payload

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:

  1. After the trigger setup, take throw new fault activity and provide as following
    1. Code as "BUSINESS_ERROR"
    2. Reason as "Mandatory fields are missing from the request payload"
    3. Details: concat mandatory field names and request wrapper using get-content-as-string() function.
    4. Add skip condition : add for all the mandatory fields like channelid !='' etc
  2. In the global fault, define the business logic like here, 
    1. we are sending the fault details to third party Saas software Datadog from there, it will emit alerts notification to desired support team
    2. 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

Featured Post

OIC - OIC Utility to Reprocess Failed Real-Time Integration JSON Payloads

📌 Use Case In real-time OIC integrations, JSON payloads are exchanged with external systems via REST APIs. When such integrations fail (du...