Usecase: Here, we will see how to perform append operation using Data stitch action.
We will feed array of ids, for each id, call a another service and check the id exist value true or false in a scope and assign the values to a global oblect variable response item and finally append the item to response array object. Next we will get all the id responses outside of the scope.
Why data stitch:
- We can incrementally build a message payload from one or more existing payloads with the stitch.
- Supports both partial and full replacement of the message payload.
- Supports both scalar and complex type variables
Implementation steps:
- Create a rest trigger and create an appdriven orchatration integration and configure rest request - response payload
- Take a for each loop and iterates for each data - Id
- Take a scope
- Call integration action or rest call to get the details for the give id.
- Create two golbal variables
- One for response Array which will have the array of Id responses
- One for response Item which will have one id item response
- Take a stitch action and perform the following
- Assign the response id to response_item id
- Assign the response Exists value to Response_item exists
- Append the response_item result to response_array result.
- Outside of the scope, map the global responae_array data to final rest response.
Detailed steps with snaps:
No comments:
Post a Comment