Interactive API Docs - Feature of FastAPI
Explore the benefit of automatic UI documentation offered by FastAPI for all your APIs.
We'll cover the following
Introduction to automatic UI documentation
One of the major benefits of FastAPI is that it is fully compatible with open standards for APIs, OpenAPI and JSON Schema. It provides an automatic UI generated for testing your entire API and its different routes. If you have previously used Postman, you will be able to see that the same thing is provided by FastAPI
. Any API consumer can visit this UI to test all the routes and see what different parameters, header, body, etc. are required as well as the response from the API.
Try the API documentation provided by Swagger UI
The following is detailed in the official documentation of Swagger UI:
Swagger UI allows anyone — be it your development team or your end consumers, to visualize and interact with the API’s resources without having any of the implementation logic in place. It’s automatically generated from your OpenAPI Specification, with the visual documentation making it easy for back-end implementation and client-side consumption.
The following is detailed in the official documentation of OpenAPI:
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interfaces description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic.
To try the UI documentation, you can start the server, and then visit the URL provided below:
http://localhost:8000/docs
You will see a nice UI as shown below.
Get hands-on with 1200+ tech skills courses.