Layer 7 API Management

Expand all | Collapse all

Message Routing(Route via HTTP) - Customize Request Query String

Jump to Best Answer
  • 1.  Message Routing(Route via HTTP) - Customize Request Query String

    Posted 11-23-2017 09:41 AM

    I have below requirement and looking for approach to achieve it

     

    Requirement : Read request header before "Routing via HTTP" assertion and append in request as  query string.

    e.g. Get value header parameter i.e. siteId="US_SiteID" and append in /public/v1/cart?siteId=US_SiteID

     

    Idea on above problem :  Get ${request.http.header.<header-parameter-name>} and append with URI using ${request.http.parameter.<parameter-name>}

     

    Challenge : How to set custom query string in request 

     

    Approach : Custom assertion to read request header parameter value and append in request URI as /public/v1/cart?siteId=US_SiteID

     

    Shall I go for custom assertion? if no,It would be great if anyone help me to achieve using out of the box policy assertions.



  • 2.  Re: Message Routing(Route via HTTP) - Customize Request Query String
    Best Answer

    Posted 11-23-2017 05:35 PM
      |   view attached

    The logic you are looking for does not require a custom assertion to be generated. The variables are available in the system already along with some built in assertions. The input variables generated when the gateway receives the request are outlined here: Transport Layer Context Variables - CA API Gateway - 9.2 - CA Technologies Documentation . I've attached a sample policy on how to do what you are looking for with some added logic if the parameter does not exist.

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support

    Attachment(s)



  • 3.  Re: Message Routing(Route via HTTP) - Customize Request Query String

    Posted 11-24-2017 05:58 AM

    Thanks Stephen a lot,

    I test scenario (below logic) and able to get expected result. Do I need to us URL Encode assertion ?



  • 4.  Re: Message Routing(Route via HTTP) - Customize Request Query String

    Posted 11-24-2017 12:09 PM

    The URL encode is needed as we decode the URL on the way in and if we don't re-encode prior to the HTTP Routing it will fail with unknown characters.

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support



  • 5.  Re: Message Routing(Route via HTTP) - Customize Request Query String

    Posted 11-27-2017 07:14 AM

    Thank you Stephen