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.


#API Connect
#Applicationintegration
#APIConnect
 View Only
  • 1.  How to read input variable in policy

    Posted 5 days ago
      |   view attached

    I created a custom policy and declared one input for this policy as a string, and I need to read this input to perform further operations on it.

    What is the correct syntax to read it?



    ------------------------------
    Abdelazim Elkhole
    Integration Developer
    Envnt
    Riyad
    0508866204
    ------------------------------

    Attachment(s)

    yaml
    customPolicy.yaml   9 KB 1 version


  • 2.  RE: How to read input variable in policy

    Posted 4 days ago

    Hi,

    You can use a MAP policy to read an input into a custom policy: https://www.ibm.com/docs/en/api-connect/10.0.8_lts?topic=policies-map 



    ------------------------------
    Nick Cawood
    API Connect Consultant
    IBM Expert Labs
    IBM UK Ltd

    https://www.linkedin.com/in/nickcawood/
    ------------------------------



  • 3.  RE: How to read input variable in policy

    Posted 4 days ago
      |   view attached

    Hi,

    I tried to use a map in a custom policy, but I also can't able to access the input 
    I attached the YAML file can look for it and tell me if I did anything wrong



    ------------------------------
    Abdelazim Elkhole
    Integration Developer
    Envnt
    Riyad
    0508866204
    ------------------------------

    Attachment(s)

    yaml
    customPolicy.yaml   10 KB 1 version


  • 4.  RE: How to read input variable in policy

    Posted 3 days ago
    Edited by Steve Linn 3 days ago

    Hi Abdelazim,

    There are numerous sample custom policies at https://github.com/ibm-apiconnect/policy-apigw/tree/master/user-defined-policies that you can use as examples.  I believe you will access your UDP property using the variable local.parameter.code.  When your UDP is executed, all of the values for that instance of the policy will be in local.parameter.<property name>.

    Best Regards,

    Steve



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



  • 5.  RE: How to read input variable in policy

    Posted 3 days ago

    Hi Steven,

    I tried the syntax local.parameter.code, and it's working fine.
    More Thanks. 



    ------------------------------
    Abdelazim Elkhole
    Integration Developer
    Envnt
    Riyad
    0508866204
    ------------------------------