Amplify API Management

Hit the ground running with AMPLIFY™

The shift from a pure on-premises landscape of applications to a hybrid mix of SaaS and on-premises applications has resulted in new and bigger challenges for companies attempting to simplify enterprise application integration. You can find a lot more details on that particular subject in this blog. In this article, we’ll go a little bit more hands-on and will show you an approach that enables you to accomplish that integration goal – while leveraging your existing (API) investments.

AMPLIFY–leverage the platform

This is the first in a series, and in this one, we’ll show you how to connect/integrate your on-premises applications with one or more cloud applications leveraging the AMPLIFY™ platform. As you’ll see, it is easier than you think. Even better – apart from the demonstrated, UI based, the approach we can completely automate this and integrate this in your DevOps cycle. Similar to a previous blog, we will be using the pet store API for our setup.

After completing the steps, we will have an integration flow that logically looks like this:

More in detail, the picture looks like this:

Hit the ground running with AMPLIFY™

We are this example to request the addition of a pet in a dummy application, but it is easy to imagine how the exact same logic can be used to request the status of an order/payment or file transfer based on an order/invoice or customer number in an enterprise application

Let’s establish the basics first.

  • You need access to the AMPLIFY API Management solution. If you have another API Gateway solution in place, that can work as well – it just changes the first step of this walkthrough.
  • You need access to the AMPLIFY platform. Sign up for a free 30-day trial of the AMPLIFY platform here.
  • The second assumption in this walkthrough is that the interfaces you would like to integrate are externally accessible through the Gateway.
  • In this walkthrough, we will be connecting an internal application with Slack. Creating an account is easy and free.

With that out of the way, let’s start making this real.

Step 1: Create/Export your API definition(s)

First, we want to get the definition of the interface that we would like to integrate with. For this particular walkthrough, we will be using a public, free API (https://petstore.swagger.io/) and pretend for this exercise that this is our internal API (which we are going to expose and access through API Manager–so there is no difference with an actual internal application).

  1. Log in to your API Manager (if you haven’t already done so)
  2. We first need to create a Backend API.
    1. Navigate in the left menu to Backend API
    2. Select New API –> Import Swagger API
    3. Source: Swagger definition URL
    4. URL: https://petstore.swagger.io/v2/swagger.json
    5. Name: Petstore
    6. Organization: <Pick one of your organizations from the dropdown>
    7. Click Import
  3. Create a new frontend API (based on the backend API you just imported)
    1. Navigate in the left menu to Frontent API 
    2. Select New API –> New API from Backend API
    3. Select Petstore HTTP 1.0.1 or Petstore HTTPS 1.0.1 from the dropdown and click OK
  4. Pick a unique resource path, e.g. /petstore/v5
  5. Select for Inbound Security: Pass Through, confirm by clicking OK.
    1. We’ll cover additional security options in a following blog – for simplicity, we’ll stick to pass through in this example
  6. Click Save
  7. Select the Petstore API in the Frontend API list and publish it to the API Catalog  (option under Manage Selected)
  8. Navigate to the API Catalog (in API Manager)
  9. Click the new API and select Download Swagger 2.0

After completing this step, we have an API interface that we can add to our unified Catalog.

You can now continue with Step 2.

Step 2: Add your API interface to the platform

  1. Login to the Platform (https://platform.axway.com)  – if not logged in already.
  2. Navigate to My Capabilities
  3. Select Central.
  4. From the menu on the left, select API Proxies
  5. Click Register API
  6. Click Browse for files
  7. Select the swagger you downloaded in the previous step (e.g. Petstore+HTTP.json)
  8. Select from the dropdown the right Owning Team
  9. Click Save
  10. Select Test and configure your proxy
  11. In the Deployments tab, select a runtime environment and click Deploy and afterward Add to Catalog
  12. Change details (like an additional description or specific tags) if needed and click Add to Catalog
  13. Click Go to Catalog
  14. Select the newly added interfaces and download the swagger definition (look for the icon with the little arrow)

Completing this step provides us two things:

  1. Although we could have opted to skip this step, the proxy construct provides us the ability to unify/centralize the security and governance for our backend APIs. You can find more on that, in this blog post. We haven’t really covered a lot of details around security yet but will add that in a later blog.
  2. The Catalog allows us to control the consumption and provide the end-user with a unified experience, regardless of where the back-end API originates from.

At this point, we have an API that is potentially accessible for our API clients, pending their subscription to it.

Step 3: Push your interface into Integration Builder

  1. Login to the Platform (https://platform.axway.com) – if not logged in already.
  2. Navigate to My Capabilities
  3. Select Integration Builder
  4. In the menu on the left, click Connectors and then Build New Connector
  5. Select import
  6. From the import options, select Swagger and select the downloaded swagger file from step two
  7. Click Continue Import
  8. Make sure to select Select All resources, then click Import
  9. Click Save

After completing this step, you have turned your API definition into a reusable connector template

Step 4: Configure a Petstore connector instance

The next step is to instantiate this connector

  1. In Integration Builder, Click Connectors
  2. Find your connector by typing the name or a part of the name in the search window
  3. Hover over the connector and select Authenticate
  4. A new page opens in which you can complete the configuration. In its simplest form that is just name, but typically involves authentication details as well.
    1. Our petstore example doesn’t have any security associated to it, so the only information you have to provide is a name.
  5. After providing the needed information, click Create Instance

As we started this exercise to allow us to integrate our internal application with other cloud applications, we are going to configure a 2nd, cloud application that we will be integrating with next.

Step 5: Configure a Slack connector instance

  1. If you don’t have a Slack account yet, please create one @ https://slack.com/
  2. Add a Slack channel for this demo (e.g. petrequests)
  3. In Integration Builder, click Connectors
  4. Find your connector by typing “slack” in the search window
  5. Hover over the connector and select Authenticate
  6. A new page opens in which you can complete the configuration.
    1. Make sure to enable Events Enabled
    2. Provide a name and click Create Instance
  7. Authenticate against Slack in the new window and authorize this connector to use Slack with the provided credentials.
  8. After completing the configuration, select Instances in the left menu and select edit for the connector you just created
    1. Copy the Webhook URL and save this for the next step

    Configure Slack to send notifications to the platform 

  1. Within Slack, click on Add Apps in the left menu
  2. Find Outgoing Webhooks and click Install/Add to Slack
    1. Provide the following configuration settings
      1. # Optional channel to listen on: #petrequests
      2. Trigger words: petrequest
      3. URL(s): the webhook address you copied
    2. Click Save Settings
    3. After completing this step, Slack will send an event to the AMPLIFY platform every time a request is posted in the channel

At this point, we have two configured connectors and we are ready to start integrating.

Step 6: Build a flow template

For this blog, we are building a simple flow (see illustration at the top of the page):

  • Through a Slack channel, we can request the addition of a pet, which will then be added to our on-premises application (simulated through the petstore API).
  • Once that is complete, we communicate back in Slack that the animal has been added.

Want to save some time? A ready-made flow can be found here – just import the flow template and go right to step seven.

  1. In Integration Builder, click Flows
  2. Select Build a new Flow Template
  3. From the build options, select Build new flow
    1. Name: Add a Pet
    2. Type of trigger: Event
    3. Connector Instance Variable: ${config.source}
    4. Click Save
  4. Click Variables
  5. Click Create new variable
  6. Select Connector Instance variable
    1. Name: source
    2. Click Save
  7. Click Create New Variable 
  8. Select Connector Instance variable
    1. Name: destination
    2. Click Save
  9. Click Cancel
  10. Click the +
  11. In the panel on the right, select JS Script
    1. Name: getPetName
    2. Function:

      getPetName
      1
      2
      3
      const slackmessage = trigger.body.message.raw.text;
      const petname = slackmessage.substring(11);
      done(petname);
    3. Click Save

  12. Click on the newly created step, and select Add onSuccess
  13. In the panel on the right, select JS Script
    1. Name: createPetAddBody
    2. Function:

      createPetAddBody
      1
      2
      3
      4
      5
      6
      7
      8
      9
      const body =
      {
        category: {
          name: "animals"
        },
        name: steps.getPetName,
        status: "barking"
      }
      done(body);
    3. Click Save
  14. Click on the newly created step, and select Add OnSuccess
  15. In the panel on the right, select Connector API Request
    1. Name: AddPet
    2. Connector Instance Variable: ${config.destination}
    3. Method: Post
    4. API: /Pet
    5. Click Show Advanced
      1. Body: ${steps.createPetAddBody}
    6. Click Save
  16. Click on the newly created step, and select Add onSuccess
  17. In the panel on the right, select JS Script
    1. Name: createSlackMessage
    2. Function:

      createSlackMessage
      1
      2
      3
      4
      const message = {
        "text" "Congratulations! "+ steps.getPetName + " has been added!"
      };
      done(message);
    3. Click Save
  18. Click on the newly created step, and select Add OnSuccess
  19. In the panel on the right, select Connector API Request
    1. Name: sendSlackMessage
    2. Connector Instance Variable: ${config.messaging}
    3. Method: Post
    4. API: /channels/${config.channel}/messages
    5. Click Show Advanced
      1. Body: ${steps.createSlackMessage}
    6. Click Save

We now have a functional flow, the only thing that is left to be done is to instantiate it with the actual connectors attached to it, which we will do in the next step.

READ MORE: Discover new user experience on the AMPLIFY platform.

Step 7: Create a flow instance

  1. In Integration Builder, click Flows
  2. Hover over the flow you just created
  3. Click Create Instance
  4. Provide a name
  5. Select your Slack connector as source, the Slack connector for messaging and Petstore connector as destination
  6. Select petrequests as Channel
  7. Click Create instance

That’s it, we are ready to test the flow now.

Step 8: Test

  1. In Slack, type “petrequest bobby” (without quotes) in your petrequest channel
  2. In Integration Builder, navigate to Instances
  3. Click on Flows
  4. Select your flow and click on Executions
  5. Validate the flow is triggered and executed successfully
  6. After a few seconds, you should get a response in the petrequest channel similar to “Congratulations! bobby has been added!

Try it out for your self and let me know what you think. If there is anything you need help with, feel free to reach out!

Discover more empowering information about AMPLIFY here.