Layer7 API Management

Expand all | Collapse all

Overloading API URL

Jump to Best Answer
  • 1.  Overloading API URL

    Posted 11-12-2019 01:29 PM
    It is a common practice to add id in the url as findOne instead of findAll


    {{machine}}:8081/api/customers means to findAll customers
    {{machine}}:8081/api/customers/2 means to find one with id = 2

    For using the "HTTP(S) Routing" policy, we can only provide one URL and it seems CA Gateway not passing on the id at all ?

    /api/customers/2 always route as 8081/api/customers/ ?

    Any way to configure parameter in the route policy?

    Thanks in advance for any tip.


  • 2.  RE: Overloading API URL

    Posted 11-12-2019 04:57 PM
    Hi Louie,

    Can you clarify the request? Are you routing to an external server or another endpoint on the Gateway?
    The route assertion should have no issues in routing to /api/customers/2 vs /api/customers and differentiating between the two, especially externally.

    I can see some potential issues if this is routing to another Gateway endpoint, but it would depend on how you have defined the resolution path.
    If you can provide a little more detail I will be happy to assist further, Thank you.


  • 3.  RE: Overloading API URL
    Best Answer

    Posted 11-12-2019 08:18 PM
    Dear Louie,
    Usually you can do it like this,
    1. you publish the gateway service with resolution path similar like this,
    it allows you to call the gateway with different uri, for example,

    2. you parse the uri in your policy
    use split variable assertion or regex assertion to pick up the customer id from ${request.http.uri}, and set the value to a context variable, for example ${customerid}

    3. then in the route assertion, you can set the url as,


  • 4.  RE: Overloading API URL

    Posted 11-13-2019 11:35 AM
    Thanks for the tips, I am planning to simply do http://${webAppHost}/${request.url.path}.

    Enterprise Architect Inc.