Import an API Builder API into API Manager

This document describes how to import an API Builder API into API Manager.


Introduction

API Manager provides a web-based interface that enables an API owner (either in a technical business role or IT operational role) to easily register back-end REST APIs, apply policies, and to virtualize them on the API GatewayIn this document, we will explore how API Builder services can be managed by API Manager. 

Prerequisites

This document assumes that you are familiar with API Manager and have it deployed and running in your infrastructure. For more information on API Manager, refer to the API Manager Guide or sign up for an API Management Trial.

This document also assumes that you have API Builder installed and that you have created and deployed a service. For the purposes of this document, we will use the vanilla starter application, which will be referred to as the API Builder Greet service. The API Builder Greet service is created when you execute the following command:

npx @axway/api-builder init <name>

For configuration purposes:

  • API Manager is deployed on apimgmt.gateway.192.168.99.100.nip.io
  • API Builder Greet service is deployed on greet.apibuilder.192.168.99.100.nip.io

To configuration the API Manager outbound authentication, you need to know the API key of the API Builder Greet service.

Registering with API Manager

If you know API Manager and how to virtualize backend services, integrating API Builder will be a familiar process. The steps are:

  1. Login
  2. Import the backend API
  3. Virtualize the frontend API

Login

Open API Manager and log in. In this case, the URL is https://apimgmt.rdpp-4522.192.168.99.100.nip.io/home

Import the backend API

  1. The first step is to import the Swagger service definition for the backend Greet service into API Manager. In the API section, click on Backend API.
  2. Click New API.
  3. Select Import Swagger API.
  4. API Manager requires the URL of the Swagger definition of the API Builder Greet service. Since the service is deployed and running, we will select Swagger definition URL. API Builder exposes the Swagger definition for the service under greet.apibuilder.192.168.99.100.nip.io.

    Icon

    In this example, the Greet service is being hosted in a Kubernetes cluster with Ingress rules. This is why in the image the URL is using HTTPS and not specifying the port.

  5. Name the backend API Greet and associate it with an organization in your API Manager setup. Once imported, Greet will be listed in the Backend API section.

Virtualize and configure the backend API

In order to allow API Manager to manage the backend API, you need to virtualize it. Virtualizing the API creates a frontend API proxy for your service. 

  1. Navigate to the Frontend API tab.
  2. Click New API.
  3. Select New API from backend API.
  4. Select Greet 1.0.0 in the dialog (this is the name of the backend service that we imported earlier).
  5. For demonstration purposes, we will leave the frontend API unsecured (Pass through). On the Inbound tab, select Pass Through from the Inbound Security drop-down menu.

    Icon

    This is purely for demonstration purposes, API Manager has many authentication mechanisms built-in and is extensible using policies. See Virtualize REST APIs in API Manager for more information.



    By default API Builder services are secured using an API key. The default mechanism for passing this key is to use HTTP Basic authentication, where the key is the username and the password is blank. If you are using a different authentication mechanism for you API Builder service, then this step might differ.

  6. On the Outbound tab, for Outbound authentication profile select HTTP Basic
  7. Add the Greet service API Key as the username.

    Icon

    The API key is set in the conf/default.js file in your API Builder application and is also displayed on the console when the service starts.


  8. Save the frontend API. The Greet API should now be listed as a Frontend API.

API Catalog

The Greet API will now be listed in the API Catalog.

If you view the catalog entry for Greet, you can view the documentation and try out the APIs.

Testing the APIs

At this stage, you should be able to test your API using tools like cURL or Postman. However, for convenience API Manager has built-in support for testing your APIs. This can be accessed via the catalog or in the Frontend API. Before using it some extra configuration is required, the API Manager UI runs on port 8075, whereas the APIs managed by API Manager is hosted on port 8065. Browser security will treat this as a cross-origin request, so in order to test the APIs from the browser UI, we need to enable CORS.

  1. In the Frontend API section, open the Greet API and open its CORS section.
  2. Add a new CORS configuration.
Icon

For convenience, we are granting access to all domains. Using * in production should only be done after assessing the security implications.

To test the API, click the Try It button. In this case, we're testing GET /api/greet. This is a simple API that takes a username and responds with a greeting string.

Further Integration

Now that your services are being managed by API Manager, you can leverage the entire arsenal of available features that it provides. These include:

  • Built-in support for common authentication mechanisms such as OAuth, HTTP Basic, API Key, Two-way SSL, and more. 
  • Integration with third-party Identity Management (IM) infrastructures for authentication and authorization.
  • Add governance to traffic using policies, e.g. to ensure sensitive information isn't being leaked in the response. See Configure API Manager settings in Policy Studio for further information.
  • Apply quotas on APIs. See Administer APIs in API Manager for more information.

Related Links