Layer7 API Management

Expand all | Collapse all

How to get URL params from the request and pass it to underlying systems?

Jump to Best Answer
  • 1.  How to get URL params from the request and pass it to underlying systems?

    Posted 06-03-2015 08:46 AM

    Suppose my request url is like

     

    This is my layer 7 end point

    https://host:port/GetAll/v1/123123/

     

    My underlying system, needs that 123123 as productId.

     

    How to extract it from the url?

     

    Does layer 7 provides ${request.http.params} or somethink like that?

     

    or to use Regular expression for this, if regular expression must be used please ping me sample.



  • 2.  Re: How to get URL params from the request and pass it to underlying systems?
    Best Answer

    Posted 06-03-2015 09:37 AM

    Hello

     

    You have a number of context variables to obtain all or parts of the http request:-

     

    ${request.url} would return the entire string, ${request.url.path} would return /GetProducts/v1/123123/, from here you could use an regular expression assertion to obtain the section required.

     

    You can get parameters via:-

     

    ${request.http.parameter.<name>}

     

    but this is for items after the a question mark in a url.

     

    Regards

    Christopher Clark

    CA Support



  • 3.  RE: Re: How to get URL params from the request and pass it to underlying systems?

    Broadcom Employee
    Posted 09-23-2019 09:04 AM
    Hi Christopher,

    I have a similar scenario.

    I need to user layer7 for HTTP route request Below is my URL

    Http methods: GET, POST, DELETE
    http://lnpvmft08.ash.broadcom.net:8080/CatalogFilesAPI/catalog/{catalogNo}/files

    on the above URL {catalogNo} is the variable. What variable i need to use in layer7 for this.

    Regards,
    Arun Kumar


  • 4.  Re: How to get URL params from the request and pass it to underlying systems?

    Broadcom Employee
    Posted 06-09-2015 04:54 AM

    There is a variable called request.http.uri

    I often split this using the split variable assertion, plotting on / (the slash) it then create a new variable and you can access the parts of the URI in the parts.

     

    for example if the split variable sets a var called URIparts then /GetProducts/v1/123123/ would return :

     

    ${URIparts[1]} = GetProducts

    ${URIparts[2]} = v1

    ${URIparts[3]} = 123123

     

    there would be a ${URIparts[0]} but in our case that would be empty as its the part before the first /



  • 5.  Re: How to get URL params from the request and pass it to underlying systems?

    Posted 06-10-2015 05:29 AM

    Thanks Whiar..



  • 6.  RE: Re: How to get URL params from the request and pass it to underlying systems?

    Posted 09-26-2019 03:57 AM
    Hello,

    You can have a look in this youtube video that shows exactly what you described.
    https://www.youtube.com/watch?v=3oiwIinkjno

    Kind Regards,

    ------------------------------
    Services Consultant
    www.apiida.com
    ------------------------------