Over a million developers have joined DZone.

Get - Set - Go! - Setting an attribute or variable on the Axway/Vordel API Server

· Integration Zone

Learn how API management supports better integration in Achieving Enterprise Agility with Microservices and API Management, brought to you in partnership with 3scale

I recently lead a workshop in Australia, covering exciting topics like mashing up APIs together, OAuth 2.0, and API monitoring. However, something the less exciting "How To's" can be important too. One common feature I use in the Axway/Vordel API Server is a simple Get/Set: the ability to set an attribute (i.e. a variable) in a policy then to get the value of that variable. I use the "Copy/Modify Attributes" filter to do the "Set". Below, I am setting an attribute/variable called australia.melbourne.weather to "Warm":


Next I do the "Get". So, I use a "Set Message" filter which is outputting the value of this variable, using ${australia.melbourne.weather} :


Then finally I use a "Reflect Message" filter to return my message to the client with an HTTP Code of 200:


Now, I write this up to a path called "/getWeather", like this:


So now when I call the API Server on the path of "/getWeather", I get the weather for Melbourne.


Of course, you could read the variable from a database or from another API. But in this case, I'm showing how you can set it with a "Copy/Modify Attributes" filter, which can be a useful step to perform in your Axway/Vordel API Server policies.

Unleash the power of your APIs with future-proof API management - Create your account and start your free trial today, brought to you in partnership with 3scale.

Topics:

Published at DZone with permission of Mark O'Neill, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}