QUANTRIUM GUIDES
Creating a Hello World API using Swagger UI and Python
Getting started with your first Swagger UI document
Swagger is a web-based API documentation framework. It is used to create interactive documents for APIs which are built to serve a specific purpose. Swagger UI documents enjoy many advantages when compared to other document types:
- It’s open-source
- Enable you to create and share API documentation
- Allows you to test APIs
In this article, I explain a step-by-step process for creating a Swagger UI document to get a “Hello World” response through an API which is a built-in Flask REST API framework. I will use Python and YAML files to implement Swagger UI and API with explanation.
As a pre-requisite, you are expected to have a basic understanding of Flask APIs and how they work. If you need to gain a basic understanding of Flask APIs, you can refer to the official Flask RESTful API documentation.
Steps to Create a Swagger UI Document
We will follow the following steps to build a Swagger UI document for an API function:
- First, we will create the API using the Flask web API framework.