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.  How to read Cache Variable which is set on invoke

    Posted Sun February 25, 2024 09:50 PM

    I set cache variable name /key name on invoke policy , i would like to read the variable through XSLT/Gateway script in APIConnect  as i want to use this variable different operation or API. Could you please suggest on it



    ------------------------------
    santhoshkumar surisetty
    ------------------------------


  • 2.  RE: How to read Cache Variable which is set on invoke

    Posted Tue February 27, 2024 02:32 PM

    Hi Santhoshkumar,

    There is no capability to get policy configuration, but since the invoke cache-key property is a string, you could setup a variable, for example, cacheKey, to some value and then in the invoke policy reference it in the invoke policy using $(cacheKey). That variable could be in the API as an api property, or you could setup an assembly created variable using either a set-variable policy or either GatewayScript or XSLT policy code.  Then that variable can be referenced by whichever policies that want to use the same value.
    Best Regards,

    Steve



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



  • 3.  RE: How to read Cache Variable which is set on invoke

    Posted Tue February 27, 2024 03:09 PM

    Thank you for your reply, It is good solution to reference the same value in different policy in the same API. But  I want to read this cache key in different API Called readTokenAPI after setting values in setToken API . Can two different API share same cache key , one is to read and other is to set? , As these values store in document cache of datapower , I thought that there would be way to read it.



    ------------------------------
    santhoshkumar surisetty
    ------------------------------



  • 4.  RE: How to read Cache Variable which is set on invoke

    Posted Tue February 27, 2024 03:22 PM

    Hi Santhoshkumar,
    I believe your solution is then a catalog property which is a property managed solely by the API Manager.  Note this is different from an API property's catalog specific property override value.  Upon deployment, if an API policy property detects a $(name) where name is a catalog property, it will resolve that variable prior to any publish to the Gateway.  As far as the Gateway is concerned, the API was configured with a string literal, but assuming both APIs reference the same catalog property, they'll both use the same value.  See point 21 in https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=catalogs-creating-configuring.
    Regards,
    Steve



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



  • 5.  RE: How to read Cache Variable which is set on invoke

    Posted Tue February 27, 2024 03:34 PM

    Thank you , I will check on it.



    ------------------------------
    santhoshkumar surisetty
    ------------------------------