...
- Sign in to the WSO2 API Publisher.
https://<hostname>:9443/publisher
- In the APIS menu, click Add New API.
- Select I Have an Existing API. Click Swagger URL and give
http://petstore.swagger.io/v2/swagger.json
as the URL. Click Start Creating.
Edit the information as given below.
Field Sample value Name Petstore Context /petstore Version 1.0.0 - Notice that all the API resources are created automatically when the Swagger URL is specified.
- Click Edit Source to edit the Swagger file and remove security headers. This is required to invoke the API in the Store using the Swagger UI.
Remove the security tag from the
/pet
POST resource given below. This is required to enable API invocation using the API (store) console.Code Block title Swagger - Post resource //remove the following code snippet security: - petstore_auth: - 'write:pets' - 'read:pets'
Remove the security
pet/{petId}
GET resource given below:Code Block title Swagger - Get resource //remove the following code snippet security: - api_key: []
- After removing the security tags, click Apply Changes to save the changes.
Then, click Next: Implement. Click the Managed API option. Enter the information shown below and click Next: Manage.
Field Sample value Endpoint type HTTP/REST endpoint Production endpoint http://petstore.swagger.io/v2/
Sandbox endpoint Providing only the production endpoint is sufficient. Select the options described in the table below.
Field Sample value Description Transports HTTP and HTTPS The transport protocol on which the API is exposed. Both HTTP and HTTPS transports are selected by default. If you want to limit API availability to only one transport (e.g., HTTPS), un-check the other transport. Subscription Tiers Gold, Silver The API can be available at different levels of service. They allow you to limit the number of successful hits to an API during a given period of time. Note For more information on API authentication (e.g., non authentic API invocation), see HTTP methods.
- Click Save & Publish.
Now you have successfully published an API using a Swagger defintion.
...