Site iconAxway Blog

Getting Started with Amplify Integration – Variables and Map Functions

In this blog post, we’ll look at creating, using and mapping variables in your integration. We’ll use the Getting Started with Amplify Integration – OpenAPI Connection to REST APIs as a starting point. If you have not reviewed this blog post, please do so now.

This blog post is the eighth in the “Getting Started with Amplify Integration” blog post series and builds on the knowledge gained prior. As such not all steps will be explicitly called out since they are already covered in prior posts.

You can view the technical online documentation for Amplify Integration here and you can register for a free Introduction to Amplify Integration online course at Axway University here.

In order to follow this blog post, you will need access to Amplify Integration.

Create an integration

Let’s retrieve some data from the Petstore API and use variables to store processed data from that response.

Use the integration from Getting Started with Amplify Integration – OpenAPI Connection to REST APIs as a starting point.

 

 

Test your integration to see that you are receiving data.

 

 

Array size calculation

Let look at how we can use variables and map functions to determine the number of pets returned in the response. In other words, the size of the response array property of the API call output shown in the last screen shot above. Note that in Amplify Integration, an array of JSON objects is actually referenced as a list. We’ll do this three different ways.

First we’ll create three integer variables to store our array/list size.


 

Note that next to each variable is the component name that the variable was created in. This is useful for determining where variables were created later on in the integration

Now let’s use the most straightforward method of calculating an array size and that is to use the SizeOfList function in a Map component.

 

 

 

 

 

Note the extremely large number of functions available to integration developers. The complete list can be found in the online docs here

 

Test the integration by clicking on the Test button and viewing the transaction Map step and see the value in arraysize1.

 

 

 

Note that the Petstore API can return a different number of pets than what is shown above

Another array size calculation

Let’s try to calculate the number of pets two other ways. We’ll loop over the response array and increment a counter. We’ll also discover that loops contain an iteration variable, iterator, that we can leverage. Note that since we already calculated the size using the SizeOfList function, the rest of this exercise is purely academic for the purposes of discovering other aspects of the platform.

 

 

 

 

 


 

Test your integration and check the loop step in the transaction in the Monitor.

 

 

 

Pro Tip: USE LABELS!!!! As we add more and more components to the integration it’s harder to recall what each component does during design and debug. Component labels make this much easier! Use them!

 

 

 

Summary

In this blog post we looked at using, mapping and creating variables in your integration. We determined the size of an array in an OpenAPI response three different ways and discovered how to use functions in Map components.

In future blog posts, we’ll build on our knowledge and explore more of the features of Amplify Integration to create no code integrations.

Dive deeper into what’s possible with Amplify Integration.

Exit mobile version