About this task
Let's look at a sample scenario, where you are importing
https://petstore.swagger.io/v2/swagger.json URL to create the Petstore REST API.
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. If you are an
Administrator you would have this privilege by default.
To create a REST API by importing an API from a file
Procedure
-
Click APIs in the title navigation bar.
-
Click Create API.
-
Select Import from URL.
-
Provide the URL as https://petstore.swagger.io/v2/swagger.json.
As the provided URL is public, you do not have to select the Protected check box. If
you have given the restricted access URL and if the URL is password protected, then you
must select the Protected check box. After you select the Protected check box, API
Gateway displays the Username and Password fields. Make sure you provide the login
credentials of the given restricted access URL.
Based on the specification used in the imported file, 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.
-
Provide the API name as Petstore in the
Name field.
-
Provide the version number as 1.0 in the
Version field.
-
Select the Type as Swagger as the imported Search Cruise API is
a swagger file.
-
Provide a description as Import REST API using URL in the
Description field.
-
Select the team as Administrator for which you want to assign the Petstore in the
Team field.
This field appears only when the Team feature is enabled. It displays only the teams
that you are a part of.
-
Click Create.
The Petstore API is created and the API details screen displays.
You can use this Petstore API for the following:
- Find purchase order in a pet store by Order ID
- Get the pet store’s inventory status
What to do next
Next Steps
Now that you have created the REST API, you must
- Check whether the Petstore API is imported properly by using any of the API testing
tools. For details on how to test the API, see Testing a REST API