Layer7 API Management

 View Only
  • 1.  how to pass different query parameters to back end url

    Posted Sep 09, 2019 05:05 PM
    Hi Experts,
    I have a requirement to pass different query parameters to back end url in policy. here are the examples of back end url's. sometimes there should be one query parameter and sometimes 2 or more.

    https://hostname/orders?orderId=8416531&pageSize=10&pageNo=1
    https://hostname/orders?orderStartDate=08-11-2019&orderEndDate=08-18-2019&orderStatus=E&pageSize=10&pageNo=1
    https://hostname/orders?jaOrderId=148371&storeId=1101&pageSize=10&pageNo=1

    i do not want to use save each parameter in context variable. is there a way to configure in layer 7?

    Thanks,
    Sri


  • 2.  RE: how to pass different query parameters to back end url
    Best Answer

    Broadcom Employee
    Posted Sep 10, 2019 06:54 AM
    Edited by Christopher Hackett Sep 13, 2019 02:27 PM
    Hi Sri,

    If you want to pass all of the query parameters from the request to the backend service, you can append the variable ${request.url.query} to the end of your backend url in the routing assertion like: https://backendhostname/orders${request.url.query}


  • 3.  RE: how to pass different query parameters to back end url

    Posted Sep 10, 2019 09:21 AM
    You've got a few options:

    1. As previously noted, you can just pass through the query string in the request as-is with ${request.url.query}.
    2. You can build a query string from specific query string parameters with ${request.https.parameter.<param name>}.
    3. You can build a query string using hard-coded values using whatever you want.