Dynamic URL routing using service callout

Not applicable

Hi All,

I have a question regarding the change of path in apigee. For example, I am trying to access a page with /v1/objects/list as a path. But when using my apigee api proxy, I want to access it with a different path which is /v1/docs/list using a service callout. I set the target endpoint to the base URL and not included the path. I created a proxy endpoint with a condition for /v1/docs/list. But when I try to use trace, the service callout policy doesn't appear and it seems that it doesn't enter the flow.

Please see attached screenshot for reference. Your replies will be really appreciated.

4156-apigee-error.png

0 2 1,438
2 REPLIES 2

@Junnes Ashley Pineda , You will use service callout if you would like to call any other target server before or after API request goes through the target endpoint. We need below information to better understand same.

  • Ideally, What is the proxy end point you would like to see ?
  • What is the target endpoint ?
  • What is the base path of proxy ?
  • Why are you using service callout ? It's not very clear in your question why you are using service callout at first instead of using target endpoint.

Based on my understanding,

When you make proxy call like https://proxy.com/v1/docs/list, it will hit , https://target.com/v1/objects/list

Hope it helps.

@Junnes Ashley Pineda, As per my understanding, pls find my updates below.

  • As you are trying to make dynamic URL routing using service callout, you don't need a target endpoint here. Create the proxy using "No Target" option.
  • In the service callout policy,
    • use "response" as Response variable instead of "calloutResponse" as you are not using Assign Message or Java Script policy explicitly to copy the response object
    • Default verb is "GET" hence no need to set it again.
    • (Optional): if you use "request" as Request variable then you don't need to set the "{request.querystring}" explicitly in the Path variable as it will take what ever query string you pass in the request.
  • Condition is incorrect for Conditional Flow "Get List". Change it to:

    <Condition>(proxy.pathsuffix MatchesPath "/v1/REP/documents") and (request.verb = "GET")</Condition>