I am working with Oracle Integration Cloud (OIC) and have encountered a challenge. I need to combine the responses from two different APIs into a single payload.
Here are the sample responses from the two APIs:
API 1 Response (Customers):
json
{ “Customers”: [ { “CustomerID”: “c8239”, “CustomerName”: “Robert”, “CustomerEmail”: “[email protected]” }, { “CustomerID”: “c3242”, “CustomerName”: “John”, “CustomerEmail”: “[email protected]” }, { “CustomerID”: “c4544”, “CustomerName”: “David”, “CustomerEmail”: “[email protected]” } ] }
API 2 Response (Orders):
json
{ “Order”: [ { “OrderID”: “o232”, “OrderAmount”: “15000” }, { “OrderID”: “o231”, “OrderAmount”: “18000” }, { “OrderID”: “0233”, “OrderAmount”: “17000” } ] }
I need to combine these responses into a single payload where each customer is paired with an order, as follows:
Combined Response:
json
{ “Combine”: [ { “Customer”: [ { “CustomerID”: “c8239”, “CustomerName”: “Robert”, “CustomerEmail”: “[email protected]” } ], “Order”: [ { “OrderID”: “o232”, “OrderAmount”: “15000” } ] }, { “Customer”: [ { “CustomerID”: “c3242”, “CustomerName”: “John”, “CustomerEmail”: “[email protected]” } ], “Order”: [ { “OrderID”: “o231”, “OrderAmount”: “18000” } ] }, { “Customer”: [ { “CustomerID”: “c4544”, “CustomerName”: “David”, “CustomerEmail”: “[email protected]” } ], “Order”: [ { “OrderID”: “0233”, “OrderAmount”: “17000” } ] } ] }
Additional Details:
-
Objective: I want to merge the customer data from the first API with the order data from the second API into a single, combined payload.
-
Tools: I am using Oracle Integration Cloud (OIC) and exploring the use of Data Stitch and other OIC features to achieve this.
-
Constraints: The number of customers and orders may vary, and they may not always have a one-to-one correspondence.