Tutorial: Importing an API

This tutorial shows you how to import an existing OpenAPI 2.0 definition.

About this tutorial

In this tutorial you will complete the following lessons:
  1. Importing an API
  2. Testing the imported API

Before you begin

Note: The Sandbox catalog must be configured to use either a DataPower® Gateway (v5 compatible) or a DataPower API Gateway or both. See Creating and configuring Catalogs.

If your Sandbox catalog uses a DataPower Gateway (v5 compatible) (as one of the gateways, or as the only gateway), download the findbranch.txt file to your local filesystem. Rename this file findbranch.yaml.

If your Sandbox catalog uses a DataPower API Gateway, download the findbranch_v6.txt file to your local filesystem. Rename this file findbranch.yaml.

Importing an API

To import an API, complete the following steps:
  1. Log in to API Manager UI.
  2. On the Home page, click the Develop APIs and Products tile.

    API Manager Home page

  3. On the Develop page, click Add > API.

    Add API screen

  4. Ensure that OpenAPI 2.0 is selected.
  5. In the Import section, select Existing OpenAPI. Click Next.

    Existing OpenAPI option

  6. Click Drag and drop files here or click to upload.
    Click the message to upload a file
  7. Select the findbranch.yaml file on your local file system and upload it. Then click Next.

    Validated file is ready to import

  8. Select Activate API. Click Next.

    Activate to publish API with Product

  9. The Summary page displays.

    The new API is created and made available online (activated) for use. The API cannot be executed unless it is active.

    The summary displays the API's endpoint, and the sandbox catalog's client ID and client secret, which you can use for testing the API.

    Summary of the imported API

    Leave the Summary page open for the next step.

Testing the imported API

Note: Due to Cross-Origin Resource Sharing (CORS) restrictions, the assembly test tool cannot be used with the Chrome or Safari browsers on the macOS Catalina platform.
To test the imported API, complete the following steps:
  1. In the Summary page, click Edit API
  2. On the Develop / findbranch page, click the Assemble tab in the page header.

    FindBranch API

    The Assemble page provides a set of tools for visually defining an API by selecting policies (such as actions and logic constructs) and dragging them onto the canvas. You can add details about each policy in its properties settings.

    The imported FindBranch API already has a definition, which uses a single policy called "Invoke" to execute the API. This API is ready to test.

  3. On the Assemble page, click the Test icon Test in the tool bar that displays after the page header.

    Assemble page

  4. In the Test panel, look in the Operation section and select the get /details operation.
    Note: The Test panel displays a message warning that the Assembly page test tool is deprecated. However, the tool is still available in this release for a quick test of your imported API. You can close the message box by clicking the x.

    Test panel

    The sandbox's client ID automatically displays in the "Identification" section to ensure that even if the API requires a client ID, it can be tested on this page.

  5. Click the Invoke button that displays at the end of the Test panel.

    If the response returns an error message about with a browser certificate error, click the URL in the message to override the error.

    Test invoke

    A new browser tab opens and might display an error message, but you can ignore it. Close the new tab and return to the Test panel.

  6. Click Invoke again. The response includes the "200 OK" status code and displays the branch data returned by the FindBranch API.

    Response to successful API call

What you did in this tutorial

In this tutorial, you completed the following activities:
  • Imported an API definition.
  • Tested an API.