Importing API definition into gateway using swagger.

In this post I will show you how you can publish an API to the API Cloud using a swagger definition. If you do not have an account with the WSO2 Cloud you can read my previous blog post about WSO2 cloud where i have mentioned how you can create a free account with the cloud.

Let’s get started. First log in to the WSO2 Cloud and select the API Cloud.

  • Once you select the API Cloud you will be directed to this particular page. This is the API Publisher. Using this you will be able to create and publish APIs and carry out many other tasks related to the management of your API.
  • In order to import an API definition using swagger you first need to select the ‘Add’ menu item in the left menu bar.
  • After which you will be directed to a page as shown below. Select the first option which is ‘I have an Existing API’.
  • In the expanded section import the API definitions using a swagger file. In this case you need to upload a swagger file. You can find the swagger file used in this example here. This is a simple phone verification API.
  • Then click on the ‘Start Creating’ button to start the creation of the API.
  • You will be directed to the page displayed below. As you can see the methods and details have been displayed using the swagger definitions.
  • Include the context as /phoneverify and click on the the ‘Next Implement’ option.
  • Select the Managed API option and you will see the UI as shown below. Here we need to specify the service endpoint for the particular API.
  • Select the HTTP Endpoint option and provide this value as the production and sandbox endpoints. http://ws.cdyne.com/phoneverify/phoneverify.asmx
  • Next select the ‘Next Manage >’ button.
  • In this section select the ‘Tier Availability’ as ‘Gold’.

Now you have successfully imported API definitions using a swagger file and published you API. In my next blog post i will be discussing how to subscribe to an API and also set different rate limits and throttling policies on the APIs.

References — Create and Publish an API.