Layer7 API Management

 View Only
  • 1.  Obtain the resolution path as context variable in the policies

    Posted Aug 13, 2015 05:16 AM

    Hi all,

     

    Is there any possibility to get the resolution path of the actual api in the policies of this api as a context variable?

     

    Regards,

    Andi



  • 2.  Re: Obtain the resolution path as context variable in the policies

    Posted Aug 13, 2015 06:31 AM

    Hi Andi,

     

    What do you mean by actual api? Are you refering to the service url that is been accessed by used via the gateway?




  • 3.  Re: Obtain the resolution path as context variable in the policies

    Posted Aug 13, 2015 06:42 AM

    Hi Shashank,

     

    No I mean the custon resolution path of an api (Can be set in the properties of an api). I would like this part to have as context variable in the policies of this api.

    resolution_path.png



  • 4.  Re: Obtain the resolution path as context variable in the policies

    Broadcom Employee
    Posted Aug 13, 2015 11:40 AM

    There is a predefined context variable for the request making a call to that service: ${request.http.uri}, so when the service is being called this variable will print the URI, in this case "/my/path".

     

    Note that if you add more resource paths to the URI in the request it will print those as well, but it will not print parameters made in the request.


    Ex: if your request was "http://gatewayurl:8080/my/path/test?p=100" it will print "/my/path/test".



  • 5.  Re: Obtain the resolution path as context variable in the policies

    Posted Aug 13, 2015 01:31 PM

    As an addendum to this: If you want the query parameters then you want to use ${request.url.query}



  • 6.  Re: Obtain the resolution path as context variable in the policies

    Posted Aug 19, 2015 04:27 AM

    Yes I know both of these context variables..

     

    What I want to do is to remove the custom resolution path from the mentioned variable ${request.http.uri}:

    Custom resolution path = /my/path*

    From ${request.http.uri} = /my/path/test

    To = /test

     

    In a normal API you can do this with the assertion "Evaluate Regular Expression" because you know what you want to remove (in this case it is "/my/path*").

    But I would like to automate this behaviour within an Encapsulated Assertion which will be used when a user creates a new api in the portal. In this case you do not know what you have to remove, because every api has its own resolution path.

    You could say now, that I could use an input variable for the encapsulated assertion, but I hope that there is an easier way to do so because in my opinion every api should know its own resolution path.

     

    Therefore I ask if there is any possibility to get the exact string of the resolution path e.g. "/my/path*" as a variable?



  • 7.  Re: Obtain the resolution path as context variable in the policies
    Best Answer

    Posted Aug 19, 2015 09:24 AM

    Unfortunately, there is not a single variable that returns that information. It might be worthwhile to resubmit that part of the request as an Idea in this community as that is a great opportunity to submit recommendations for improving the product. With regards to your specific request--you may need to dig into the API Gateway database in order to get this information. It is possible that the database schema could change with any given update so this information is provided with that caveat. There is also the additional caveat that querying the Gateway database directly is not--strictly speaking--supportable as the schema may change without warning as indicated. That having been said, you may be able get this information with a SQL query against the Gateway: SELECT routing_uri FROM ssg.published_service WHERE hex(goid)="${service.oid}"



  • 8.  Re: Obtain the resolution path as context variable in the policies

    Posted Aug 21, 2015 02:10 AM

    Ok I will post it as an idea.

    But I think for my case it is safer to use another input variable in the encapsulated assertion rather than using an unsupported sql statement. But thank you anyway



  • 9.  Re: Obtain the resolution path as context variable in the policies

    Posted Aug 21, 2015 06:19 AM

    res13: Don't forget to vote on your own idea. The platform doesn't add your vote automatically when you create an idea.