Swagger Inspector and Swagger Hub Hands-on Recently SmartBear announced its new tool for developers to test APIs and generate OpenAPI called Swagger Inspector. In this article, we shall see about Swagger Inspector and how to use it effectively in testing APIs and generate OpenAPI.
Table of Contents
What is Swagger Inspector?
Swagger Inspector is a online web application for developers, testers, product managers and whoever interested to test APIs and to generate documentation about the APIs like this.
Prerequisites
To get started with Swagger Inspector, you must have Chrome browser with Swagger Inspector Extension. Without the Chrome extension, you cannot work with Swagger Inspector.
Get Started
Visit https://inspector.swagger.io to get started. You need to sign up using GitHub or email. It is completely free to use.
Test your first API
Simply select the HTTP method and enter the URL, add the parameters/headers/body and hit SEND button. Below is the snapshot of google.com request.
Swagger Inspector Features
- It supports all the HTTP methods.
- You can pre fill the data to try the features. It supports file upload as well.
- It stores all the requests in the History.
- You can create Collections for your APIs.
- Simple and elegant UI; but you cannot change the theme.
It works only on Chrome with Swagger Inspector extension; but not on other browsers.
How to create API documentation using Swagger Hub?
All the API calls will get logged in the History tile. Just check the API calls and hit CREATE API DEFINITION as shown in below screen capture. It is quite simple to create API definitions.
<iframe src=”https://embed.cl.ly/p44F” width=”575″ height=”400″ style=”border:none” frameborder=”0″ allowtransparency=”true” allowfullscreen=”true”></iframe>
If you want to create API designs using Swagger Hub, go to this link https://app.swaggerhub.com/signup?channel=directWithinApp and signup yourself with your GitHub account or using your email id. Once you signed in, you can see the below hub.
Is it free?
Swagger Hub has three plans: Free, Team, and Enterprise. Team plan starts from $75/month (annual payment) for 5 users. If you want to deploy on-premise or cloud, you need to contact the sales team for the billing rates.
In free plan, you get below privileges for 1 users, basic API design and documentation features.
How to create your first API design in Swagger Hub?
Login into your Swagger Hub, in the left side click on plus icon and then click on CREATE NEW > Create New API as shown below.
It will display below dialog box; either you can create API from the template or you can create a blank API by selecting None. In this example, we shall create a PetStore API as shown below.
Once you click on CREATE APIÂ button, Swagger Hub will create a API of PetStore as shown below.
It has three views: Editor, Split and UI. In the Split view, you can see the code view as well as WYSIWYG. If you want to edit the APIs, toggle to Editor/Split view and make changes. Once the changes are made, hit Save button.
By default, your API will be in UnPublished status, to publish the API, simple hit Publish as shown below.
In Swagger Hub, you can create documentation, add the metadata about the API, add the integrations, fork API, compare and merge API, GitHub push, share and collaborate API and many more.
Simple UI enables us to write OpenAPI 3.0 and Swagger 2.0 specifications. You can keep all the APIs in one place so that it will be easy to maintain and manage the APIs.
You can view all of your APIs in the MY Hub page. Also, at any point of time, you can unpublish and delete the APIs.
Overall
Swagger Inspector is a simple and effective web application to manage and design APIs in a single platform. It is simple to write the OpenAPI and Swagger and publish it immediately using Swagger Hub. But the UX can be improved. There is no downloadable version of Swagger Inspector/Hub. Also, you must install the Chrome Extension to get started with Swagger Inspector. By blending Swagger Inspector and Hub, you can maintain and manage all your APIs in one place. Definitely Swagger Hub and Inspector is a neat tool for developers and testers; it will boost productivity and benefits the API workflow.