Swagger UI is an interactive web page that lets you explore and test a REST API.
FastAPI auto-generates Swagger UI at the /docs path.
Actions:
-
Open in a browser:
<lms-api-base-url>/docs.Replace the placeholder
<lms-api-base-url>.You should see the
Swagger UIwith all endpoints listed.
If the API requires authentication:
- Open
Swagger UI. - Click the
Authorizebutton (lock icon at the top right). - In the
Valuefield, enter the<api-key>. - Click
Authorize. - Click
Close.
All subsequent requests will include the API key in the Authorization header.
- Open
Swagger UI. - Click on an endpoint (e.g.,
GET /items). - Click
Try it out. - Fill in parameters if needed.
- Click
Execute. - See the response below: status code, response body, headers.