How do we prematurely end a proxy endpoint flow?

I have an API proxy and I'm using a ServiceCallout policy to call another endpoint within the same organization in another API Proxy. After receiving the response from the callout, I would like to finish the flow instead of allowing it to continue and hit the original endpoint.

I tried to use a Fault Raise to stop the flow but that's an anti-pattern https://docs.apigee.com/api-platform/antipatterns/raise-fault-conditions#using-raisefault-policy-to-....

Thanks.

Solved Solved
0 5 509
1 ACCEPTED SOLUTION

sidd-harth
Participant V

Alex why would you do that, redirecting traffic from one endpoint to another?

What is the use of the original target endpoin in the proxy which is using service callout?

If not fault rules, then try using RouteRules.

After getting a response from Service Callout policy set/create conditions using Javascript or use any variable from Service callout response to enable a Route Rule to call no-target

https://community.apigee.com/articles/2818/configure-a-proxy-not-routing-it-to-any-target-ser.html

View solution in original post

5 REPLIES 5

@Alex Ouy - When do you want to hit the original endpoint ? Do you want to hit it only if the Service Callout fails, response does not have anything specific ??

@Sai Saran Vaidyanathan I'm actually trying to redirect all traffic that's hitting an endpoint to another endpoint. I'm using the Service Callout policy in the preflow to redirect all traffic to the secondary endpoint. And I'm trying to return the response from the Service Callout policy to the original API.

sidd-harth
Participant V

Alex why would you do that, redirecting traffic from one endpoint to another?

What is the use of the original target endpoin in the proxy which is using service callout?

If not fault rules, then try using RouteRules.

After getting a response from Service Callout policy set/create conditions using Javascript or use any variable from Service callout response to enable a Route Rule to call no-target

https://community.apigee.com/articles/2818/configure-a-proxy-not-routing-it-to-any-target-ser.html

Thanks for the response Siddharth Barahalikar. Because we have such a large monolith with many clients behind our API proxy, we would like to move an endpoint to another service without affecting the clients

Not applicable

You want to stop the flow after getting service callout response.

There is no reason behind that to stop even. If you would get error and stop that would be a genuine case.

If you only want to do a callout the. You can go for no target api and use the service callout there.

And if you want to make the way you are trying now, then you can route the request to no route, so that it will not go to your backend.