Site iconAxway Blog

Create an Integration Builder Connector to an API Builder Microservice

create an integration builder connector

create an integration builder connector

In this blog post, we’ll describe how to create an Integration Builder connector to an API Builder Microservice. We’ll create an API Builder project, run it and export its swagger definition. Then we’ll import the swagger into Integration Builder and create a connector that can be used in Integration Builder flows.

Create your API Builder Project

In this section, we will create an API Builder project and get the swagger for it.

ngrok http 8080

This will create a public URL that maps to http://localhost:8080. Make note of the ngrok public URL as we’ll need it shortly

Integration Builder

In this section, we will create an Integration Builder connector to our API Builder microservice by importing the API Builder swagger file.

We can edit the swagger and replace:

"host": "localhost:8080",

with the ngrok public URL, e.g.:

"host": "07e6f785.ngrok.io",

Alternately, we can change this url in Integration Builder after importing it. Let’s do the latter.

  • Click on the Connectors tab and click on the BUILD NEW CONNECTOR button

  • Click on the Swagger tile and click the FROM COMPUTER button to select your API Builder swagger file

  • Leave Authentication as Custom

  • At this point we’re done and we can create an instance of this connector and test it as follows:

  • Click the Test in API Docs tile. Click the GET /greet API and click the Try it out button

  • Enter any string in the username field and click on the Execute button

  • Docker Container

    Stop your API Builder project from running (ctrl-C).

    Following the instructions here let’s create and run our API Builder microservice in a Docker Container and see what, if any, changes need to be made to the Integration Builder connector we just created. Hint: None!

    Let’s create our Docker container as follows:

    docker build -t apibdemo ./
    

    Note that my API Builder project is called apibdemo. In the command above, I am specifying apibdemo as the name of the resulting Docker image

    Run your container using:

    docker run --name apibdemo -p 8080:8080 -d apibdemo
    

    Note that we are mapping API Builder port 8080 to the host port 8080

    Go back to Integration Builder and test your greet API and see that it’s working just as before. The difference is that now your API Builder microservice is running in a Docker container.

    When you deploy your API Builder container into a production environment, you can modify the Integration Builder connector’s base address with the URL corresponding to your production environment.

    Summary

    In this blog post, we demonstrated how to import an API Builder swagger into Integration Builder in order to create connector for our API Builder microservice. This enables us to leverage API Builder microservices in your Integration Builder flows.

    Exit mobile version