Creating a REST API by importing an API from a URL

Before you begin

Ensure that you have

  • The URL from where you want to import the API.
  • Manage APIs or Activate / Deactivate APIs functional privilege.
    Note: If you are an Administrator, you have this privilege by default.

About this task

This example explains how you can create a REST API by importing https://petstore.swagger.io/v2/swagger.json URL .

Procedure

  1. Open the menu options and select APIs.
  2. Click Create API.
  3. Select Import API from URL.
  4. Provide the URL as https://petstore.swagger.io/v2/swagger.json
    Note: As the provided URL is public, you do not have to select the Protected checkbox. If you have given the restricted access URL and if the URL is protected by a password, then you must select the Protected checkbox. After you select the Protected checkbox, webMethods API Gateway displays the username and password fields. Make sure that you provide the login credentials of the given restricted access URL.
    Based on the specification used in the imported file, webMethods API Gateway auto populates the Type field. REST API supports the Open API, RAML, or Swagger specifications. As the
    https://petstore.swagger.io/v2/swagger.json
    URL is a swaggerfile, API Gateway, by default, selects the file type as Swagger.
  5. Provide the API name as Petstore in the Name field.
    • If you provide an API name, webMethods API Gateway overwrites the API name that is specified in the uploaded file.
    • If you do not provide an API name, webMethods API Gateway retains the API name that is mentioned in the uploaded file.
    • If you do not provide an API name and the uploaded file does not have an API name, the API name is displayed as Untitled.
  6. Provide the version number as 1.0 in the Version field.
  7. Provide the description as Import REST API using URL in the Description field.
  8. Select the team as Administrator for which you want to assign the Search Cruise in the Team field.
    Note: This field appears only when the team feature is enabled. It displays only the teams that you are a part of. If you have the User management functional privilege, all teams are displayed. You can select more than one team.
  9. Click Create. The Search Cruise API is created to search a cruise by cruise ID.
  10. Now that you created the SearchCruise API, you can check whether it is imported properly by using any of the API testing tools. To know more about how to test the REST API that uses Postman, see Testing a REST API.