Dear Community, How to get the exact http response from a child pipeline to the parent pipeline? Also i wanted the parent to fail so that it triggers the error pipeline and post the child pipeline's exact http error response.
Hello Amrith, 1. Getting the exact HTTP response from child โ parent In the child pipeline: - After your REST snap (GET/POST/etc.), pass the full response document through to the output - The REST snap outputs response_body, http.status, http.headers etc. โ keep them all - Make sure the child pipeline has a Pipeline Out snap (the output goes back to the parent) In the parent pipeline: - Use a Pipeline Execute snap to call the child - The output of Pipeline Execute = whatever the child's Pipeline Out emits - You now have the full HTTP response document available in the parent 2. Making the parent fail + trigger error pipeline with the child's HTTP error Two approaches depending on your setup: Option A โ Child fails, parent inherits the failure - In the child pipeline, after the REST snap, add a Mapper that checks http.status - If status โฅ 400, route to a Raise Error snap with a message like "HTTP ${http.status}: ${response_body}" - In the parent's Pipeline Execute snap โ set "Continue on error" to false - The parent will now fail with the child's error message, which flows into the parent's error pipeline Option B โ Parent catches and re-raises - In Pipeline Execute snap, enable the error view (the red triangle output) - Connect that to a Mapper โ Raise Error snap in the parent - The error document from Pipeline Execute contains error_message (which is whatever the child raised) - Use $error_message to re-raise with the exact HTTP details Pro tip for preserving the full HTTP body in the error: In the child, before Raise Error, map your error message like:
"HTTP " + string($http.response_status_code) + " โ " + string($response_body)