We need to design my API proxy such that it would call two target endpoints sequentially.
Usecase flow :-
Client calls API proxy-->API proxy calls TargetEndpoint1-->TargetEndpoint1 gives response-->API proxy works on TargetEndpoint1 response-->API proxy calls TargetEndpoint2-->TargetEndpoint2 gives response-->API proxy works on TargetEndpoint2 response-->API proxy gives response to Client
Please let me know how can we achieve this ?
We can achieve this using one of the following ways:
Option #1
- Make the call to your target #1 via a Service Callout Policy.
- Process the response from the target #1.
- Make the call to your target #2 via the target endpoint.
Note: You can also use Javascript or Javacallout policy in step #1.
Option #2
- Have a NodeJS as the target server in your API Proxy.
- Within the NodeJS code,
- Make the call to your target #1
- Process the response from the target #1.
- Make the call to your target #2