This tutorial shows you how to import an existing OpenAPI 2.0 definition.
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:
- Log in to API Manager UI.
- On the Home page, click the Develop APIs and Products tile.
![API Manager Home page](tutorial_onprem_IMPORT_mgr_home_cx.jpg)
- On the Develop page, click .
![Add API screen](tutorial_onprem_APIM_apiprod_add_cx.jpg)
- Ensure that OpenAPI 2.0 is selected.
- In the Import section, select Existing OpenAPI.
Click Next.
![Existing OpenAPI option](tutorial_onprem_IMPORT_import.jpg)
- Click Drag and drop files here or click to upload.
- Select the findbranch.yaml file on your local file system and upload it.
Then click Next.
![Validated file is ready to import](tutorial_onprem_IMPORT_file_ok.jpg)
- Select Activate API. Click Next.
![Activate to publish API with Product](tutorial_onprem_IMPORT_activate.jpg)
- 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](tutorial_onprem_IMPORT_summary.jpg)
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:
- In the Summary page, click Edit API
- On the Develop / findbranch page, click the Assemble
tab in the page header.
![FindBranch API](tutorial_onprem_IMPORT_findbranch_info.jpg)
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.
- On the Assemble page, click the Test icon
in the tool bar that displays after the page header. ![Assemble page](tutorial_onprem_IMPORT_findbranch_assemble.jpg)
- 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](tutorial_onprem_IMPORT_findbranch_test_op.jpg)
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.
- 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](tutorial_onprem_IMPORT_test_yellow_error_box.jpg)
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.
- 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](tutorial_onprem_IMPORT_test_branch_ok.jpg)
What you did in this tutorial
In this tutorial, you completed the following activities:
- Imported an API definition.
- Tested an API.