API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Getting application name(X-IBM-Client) in gateway Policy

    Posted Thu February 01, 2024 08:19 AM

    Hi ,

    Is there any way we can retrieve the name of the X-IBM-Client based on X-IBM-Client-Id in gateway policy or any other way.

    I want the name during runtime of the api.

    Thank you



    ------------------------------
    Syed Imtiyaz Alam
    ------------------------------


  • 2.  RE: Getting application name(X-IBM-Client) in gateway Policy

    Posted Thu February 01, 2024 11:53 AM

    Hi Syed,
    See https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=reference-api-connect-context-variables.  The client name is in the context variable client.app.name.  Assuming you're using GatewayScript in an API Gateway API, you would access it with

    let clientName = context.get('client.app.name');

    In XSLT, 

    <xsl:variable name="clientID" select="apigw:get-variable('client.app.name')"/>

    where our course your xsl:stylesheet has provided the correct namespace associated with the apigw prefix.

    Regards,
    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 3.  RE: Getting application name(X-IBM-Client) in gateway Policy

    Posted Thu February 22, 2024 01:36 PM

    Thank you Steve. I am trying to use this variable on the Switch and getting some validation error

    I tried with this below:

    ($httpVerb() = 'POST' and $contains($string($client_app_name),

                    Default-Test))

    Any suggestions please.



    ------------------------------
    Syed Imtiyaz Alam
    ------------------------------



  • 4.  RE: Getting application name(X-IBM-Client) in gateway Policy

    Posted Thu February 22, 2024 01:53 PM

    Hi Syed,

    Please try:

    ($httpVerb() = 'POST' and $contains($string(client.app.name), 'Default-Test'))

    I also don't believe the $string function is required, so you can also try without it

    ($httpVerb() = 'POST' and $contains(client.app.name, 'Default-Test'))

    Best Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------