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 pass an object as input to UDP

    Posted Wed January 22, 2025 03:38 PM
    Edited by vijaya k k Thu January 23, 2025 09:04 AM

    In my API, we have an invoke policy with a Response Variable object set to a variable name consumerResponsevAR. I need to pass that consumerResponsevAR object as an input to the UDP. The UDP needs to perform validations against that object. How can this be achieved? Your inputs are appreciated. Just to add, this UDP is widely used by different consumers, so using context.get("consumerResponsevAR.body") cannot be used in the UDP as different consumers can save it to different variable names.



    ------------------------------
    vijaya k k
    ------------------------------



  • 2.  RE: how to pass an object as input to UDP

    Posted Thu January 23, 2025 09:39 AM

    @Steve Linn any inputs on this ?



    ------------------------------
    vijaya k k
    ------------------------------



  • 3.  RE: how to pass an object as input to UDP

    Posted Tue January 28, 2025 08:12 AM

    hi All,

    I was able to pass an object(consumerResponsevAR ) to the UDP .  Instead of passing $consumerResponsevAR ,I have passed the consumerResponsevAR  which is pass by reference which actually worked.



    ------------------------------
    vijaya k k
    ------------------------------



  • 4.  RE: how to pass an object as input to UDP

    Posted Tue January 28, 2025 08:27 AM
    Hi Vijaya,

    I would do something as below - hope it finds you well.

    1. I would send context as output and in the sequence action which is UDP would read it using context.reasAs function based on the content type and do required validation.

    2. Which is your scenario, storing response in variable - I would have my UDP configured to accept labels, so i can provide any context variable name(from previous actions). 
    And my UDP would get the context based on the name provided in the label.
    This would be more generic.

    Thx,
    Mani