Site iconAxway Blog

Introducing API Builder 3.0 with API First & Flow Editor

Prior to API Builder 3.0, API’s were tied to models exposed by connectors. While this is a powerful and easy way to expose data sources, it does not cover all scenarios and requirements and often a significant amount of Javascript was required to add features to your model based APIs.

API Builder 3.0 adds another new way to build API’s called “API First”. Also, a new graphical flow editor is included that enables developers to implement all API functionality without any coding. The flows enable custom orchestration between many disparate data sources and external services and greatly reduce the amount of JavaScript by allowing the developer to focus on data manipulation, rather than async/error handling. The flow editor and flow-node are extensible in that new flow-nodes can be created using Axway’s Flow-node SDK. More on all of this in future posts.

This blog post will introduce the API First feature of API Builder and and the Flow Editor and describe how they are used to build APIs without any code.

Overview

The following steps are used to create APIs using the API First workflow:

Design Your API

The first step is to define the API that you will build in API Builder. API Builder requires a Swagger JSON file for import so any tool that generates a Swagger file will suffice. In this example, I am using Swagger Hub but others are available, such as Stoplight.

I found the following tutorials to be helpful in learning API Design using Swagger:

The API for this post is simple and described below:

GET /hello

The response I am sending is shown below:

{
    "message":"Hello World API Builder 3.0"
}

The Swagger for my API is shown below:

{
  "swagger" : "2.0",
  "info" : {
    "description" : "This is a simple Hello World API",
    "version" : "1.0.0",
    "title" : "Simple Hello World API",
    "contact" : {
      "email" : "lbrenman@axway.com"
    },
    "license" : {
      "name" : "Apache 2.0",
      "url" : "https://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "host" : "virtserver.swaggerhub.com",
  "schemes" : [ "https" ],
  "paths" : {
    "/hello" : {
      "get" : {
        "summary" : "returns a message",
        "description" : "Simple GET REST API\n",
        "operationId" : "helloWorld",
        "produces" : [ "application/json" ],
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "description" : "response",
            "schema" : {
              "$ref" : "#/definitions/response"
            }
          },
          "400" : {
            "description" : "bad input parameter"
          }
        }
      }
    }
  },
  "definitions" : {
    "response" : {
      "type" : "object",
      "required" : [ "message" ],
      "properties" : {
        "message" : {
          "type" : "string",
          "example" : "blah, blah, blah"
        }
      },
      "example" : {
        "message" : "blah, blah, blah"
      }
    }
  }
}

I created this API definition with Swagger Hub using the Simple API option during creation of the API, editing the API to meet my needs and then I downloaded the Swagger file using the Download JSON (Resolved) option when I was done. See the screenshots for reference below:

Import the Swagger JSON file into API Builder

Use the API Builder console (https://localhost:8080/console) to import the Swagger file you downloaded above as follows:

At this point, we are ready to use the Flow Editor to implement the API!

API Builder Flow Editor

To use the Flow Editor, you drag flow-nodes from the tool panel on the left side, and drop them on to the canvas in the middle. The flow-nodes themselves can be selected on the canvas by clicking, and then configured in the options panel on the right.

This blog post is not going to dive into each of the flow-nodes and the details of configuring parameters. Configuring the parameters requires familiarity with JSONPath and doT.js. We’ll save that for future posts.

Summary

In this blog post, we illustrated how to use the API First API development flow introduced in API Builder 3.0. We imported the Swagger definition of our API and then used the drag and drop Flow Editor to configure our API without needing to do any coding.

In future blog posts, in this series, we will dive deeper into the flow editor to see how we can create more complex APIs without the need to do any coding. Stay tuned!

Exit mobile version