You can use an OpenAPI (Swagger 2.0)
definition file to add a REST API.
Before you begin
Your file must conform to version 2.0 of the OpenAPI (Swagger 2.0) specification. The format of the
file can be JSON or YAML.
Procedure
To add a REST API by loading an OpenAPI (Swagger 2.0) file, complete the following
steps:
-
Click APIs.
The APIs tab opens.
-
If you have not previously pinned the UI navigation pane then
click the Navigate to icon .
The
API Manager UI navigation pane opens. To pin the
UI navigation pane, click the
Pin menu icon
.
-
Click Drafts in the UI navigation pane, and then click APIs.
The APIs tab opens.
-
Click Add and then select Swagger 2.0, OpenAPI (Swagger 2.0), or Import an existing OpenAPI from the Import section.
The Import OpenAPI (Swagger) window opens.
- Optional:
To upload a file from your local file system, click Select file and, in
your file system, select the file that you want to use.
The following file types are supported if they contain a valid OpenAPI (Swagger 2.0) definition:
.json, .yml, and .yaml.
- Optional:
To upload a file from a URL, click Or import from URL and then provide
the correct URL in the URL field that is presented. If authentication is
required to access the URL, provide a user name and password.
The following file types are supported if they contain a valid OpenAPI (Swagger 2.0) definition:
.json, .yml, and .yaml.
-
To create a new Product and include your API in that Product, complete the following steps. (If
you want to create your API without adding it to a Product, proceed to step 8.)
-
Select Add a product.
-
In the Product template field, select Default if
you want to use the template defined as the default, to create the Product definition. This can
either be the default .hbs template file provided with the developer toolkit, or another template file that you
have configured as the default by using configuration variables. You can also select a custom
template that you created. For information about template files and configuration variables, see
Creating and
using API and Product definitions templates and Toolkit command
summary.
-
Specify values for the Product title, name, and version.
-
To publish the Product to a target Catalog, ensure that the Publish this product to a catalog check box is selected. You can clear this check box and stage or publish the Product later by using the API Designer UI and API Manager UI, as described in Staging a Product and Publishing a Product.
-
Select the Catalog that you want to use.
-
If Spaces have been
enabled, select the Catalog and Space that you
require.Your Product is staged to the Space that you
selected.
-
Click Import.
A new REST API definition is created, including Paths and HTTP operations.
Results
When the API definition has been imported, it is shown in the list of API definitions in the
APIs tab of the Drafts page.
What to do next
You can edit your API definition as you would any other REST API definition. For more information, see Composing a REST API definition.
To finish the creation of your API definition, complete the following tasks.