Usecase:
When integrating with REST APIs using Oracle Integration Cloud (OIC), it's common to encounter scenarios where the API returns different response structures based on the outcome of the operation.
For example:
Success Response:
{
"success": 1,
"trans_suc_time":""
}
Failure Response:
{
"success": 0,
"error_code": "201"
}
Managing such variations in response payloads can be challenging, but OIC provides several ways to handle this seamlessly. Here, we will explains how to effectively handle multiple response types in a single REST API integration.
{
"success": 0,
"tranc_suc_time":"",
"error_code": "201"
}
POC execution steps:
- Create REST Connections: Set up REST trigger and REST OIC self trigger invoke connections in OIC.
- Build Integration 1.0.0: Create a REST-based integration with specific request and response payloads.
- Create new version 1.0.1 and Modify: Copy version 1.0.0, modify the response payload, and activate as version 1.0.1.
- Design an Invoker Integration: Create a new integration to use a unified payload and dynamically call either version (1.0.0 or 1.0.1), keeping only one active at a time.
Detailed poc screenshots: