Master API Testing with Insomnia: A Lightweight Alternative to Postman
This guide introduces Insomnia, an open‑source, cross‑platform API client that supports GraphQL, REST, WebSockets, and gRPC, walks through its simple installation, demonstrates how to import and test the SpringBoot‑based mall project via Swagger, and highlights useful configuration tips for efficient backend debugging.
Insomnia Overview
Insomnia is an open‑source, cross‑platform API client that supports GraphQL, REST, WebSockets, and gRPC, and has earned
32Kstars on GitHub.
Installation
Download the installer from the official website (https://insomnia.rest/download) and run it; the process is straightforward.
Usage
We use Insomnia to debug the mall e‑commerce project, which is built with SpringBoot, Vue, and uni‑app, and is Docker‑containerized with a multi‑module microservice architecture. The project’s GitHub repository has over 60K stars.
Boot project: https://github.com/macrozheng/mall
Cloud project: https://github.com/macrozheng/mall-swarm
Video tutorials: https://www.macrozheng.com/video/
Steps:
Open Insomnia and create a new workspace.
Start the mall project and open its Swagger UI at
http://localhost:8080/swagger-ui/.
Import the Swagger URL into Insomnia using the import button.
After import, the API collection appears in the workspace.
Set environment variables – use the default Swagger environment and clear the
base_pathvariable.
Configure the
Authorizationheader; remove it for endpoints that do not require authentication (e.g., login).
For authenticated endpoints, add an
api_keyvariable with the token obtained from the login API.
With these settings, you can successfully test both public and protected APIs.
Additional Settings
You can adjust the font size via the settings button in the lower‑left corner, and choose from 18 built‑in themes to customize the appearance.
Conclusion
Insomnia offers a sleek interface and powerful features while remaining lightweight compared to Postman, making it an excellent choice when you need a simple, efficient tool for API testing.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.