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.  Picking Client Application Name Before Assembly in IBM API Connect 10.0.8x

    Posted Sat June 21, 2025 02:46 AM
    Edited by Manasa G Sat June 21, 2025 02:50 AM

    Hi Team,


    I am trying to pick the name of the client application before assembly. I have developed a pre request global policy to pick the name dynamically using context.get('client.app.name');
    but its giving "undefined".

    suggest any other ways using which I can pick this thing and move forward.

    Steve Linn 

    Thanks in Advance.



    ------------------------------
    Manasa G
    ------------------------------



  • 2.  RE: Picking Client Application Name Before Assembly in IBM API Connect 10.0.8x

    Posted Sat June 21, 2025 06:08 PM

    Hi Manasa,
    I'm retired and don't have access to an API Connect environment anymore to verify, so my only thought would be that the API is not associated with the client's plan so even if a client id is provided that information isn't being populated in the context.  Of course I'd recommend someone that has a working environment to verify that.  I would find it interesting to see what would be in the context variable 'plan' which would return an object with all of the plan information such as plan.name.  Of course the other explanation could be that information hasn't been extracted yet in the preflow.  Ensure that your pre request global policy has stated that it should be executed after the default preflow policies by specifying the mode property as after-builtin.  See https://www.ibm.com/docs/en/api-connect/10.0.8_lts?topic=policies-customizing-preflow#concept_nvh_xwh_qmb__title__4

    Best Regards,
    Steve Linn



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



  • 3.  RE: Picking Client Application Name Before Assembly in IBM API Connect 10.0.8x

    Posted Mon June 23, 2025 04:46 AM

    Hello Manasa,

    In what mode does your assembly run? As Steve mentioned, there is a default built-in policy, client-identification, that extracts client id, checks subscriptions and populates the context fields for the application, so if your code runs before that policy, it will not find a value in the context variable.

    So if you are running in full-custom mode, ensure the client-identification policy is still present and runs before your code. If you are running in before-builtin mode, that context variable will not work. In that case you could add the client-identification policy, but I would suggest using after-builtin or full-custom mode instead.

    Kind Regard,

    Hindrik Brouwer



    ------------------------------
    Hindrik Brouwer
    ------------------------------



  • 4.  RE: Picking Client Application Name Before Assembly in IBM API Connect 10.0.8x

    Posted Mon June 23, 2025 06:23 AM

    Hi Hindrik Brouwer,

    I was previously running the code in full-custom, but I executed it before client authentication. I've now updated the policy YAML and made sure to run the code after client authentication-and it's working perfectly.

    Thank you so much for your help!



    ------------------------------
    Manasa G
    ------------------------------