Adding a REST API by using an OpenAPI (Swagger 2.0) file

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:

  1. Click APIs.
    The APIs tab opens.
  2. If you have not previously pinned the UI navigation pane then click the Navigate to icon The Navigate to icon.
    The API Manager UI navigation pane opens. To pin the UI navigation pane, click the Pin menu icon The Pin menu icon..
  3. Click Drafts in the UI navigation pane, and then click APIs.
    The APIs tab opens.
  4. Click Add and then select [V5.0.0 only]Swagger 2.0, [V5.0.1 or later]OpenAPI (Swagger 2.0), or [V5.0.4 or later]Import an existing OpenAPI from the Import section.
    The Import OpenAPI (Swagger) window opens.
  5. 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.
  6. 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.
  7. [V5.0.4 or later] 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.)
    1. Select Add a product.
    2. Icon indicating that this applies only to the API Designer UI 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.
    3. Specify values for the Product title, name, and version.
    4. 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.
    5. [V5.0.4 and earlier] Select the Catalog that you want to use.
    6. [V5.0.5 or later] If Spaces have been enabled, select the Catalog and Space that you require.Your Product is staged to the Space that you selected.
  8. 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.