Insomnia is a great new graphical tool for testing and building REST APIs with an easy to use and slick interface.
Learn how to get up and running with Insomnia, and how to use it to test and build APIs.
- Organizing collections of requests
- Completing any type of HTTP request
- Creating new APIs based on standard specifications
- Importing and exporting data
- Customizable and user-friendly interface
The reason I started using Insomnia is primarily the interface. I used to do all my API testing using Node.js scripts and Axios, but I saw the light when I started with Insomnia. It's so easy to get up and running. Its possible to organize collections, duplicate requests, make all sorts of comments, and it supports pretty much every protocol you can think of (GRPC, SOAP, REST, XML). It's an all in one toolbox for API development.
Before starting make sure you download and install Insomnia from
Insomnia's main page lays out all the features pretty simply. You can:
- Create new environments and set environment variables
- Set cookies
- Create requests or folders for requests
Insomnia lets you organize your requests and folders very nicely, and they give you a pretty straight forward layout that lets you see what you have available right away.
To create our first request, navigate to the little plus button on the sidebar and select request from the dropdown. It will prompt you to name your request. This can be any name of your choosing. I like to give them descriptive names to keep my data organized.
You can create any type of HTTP request with Insomnia.
A request lets you do a few different things:
- Set your request body in a number of formats, such as JSON, XML, etc.
- Set your authentication method (Oauth, Basic, Bearer, and more)
- If there are any URL query parameters in your request, there is the option to add them in the query section and they'll be formatted automatically for you
- Set any additional request headers you may need
- Write any docs associated with an endpoint that you are interested in.
Once you are ready to send requests, hit the big purple send button, and you'll see your response on the right hand side. This will show any errors, returned data, or headers.
When you click the Dashboard, Insomnia will take you to a zoomed out view of all your existing Collections. Collections are their own modular areas, each with their own environments, folders, and requests. This is a great way to keep track of all the different projects you are working on, especially if you interact with many api's regularly.
You can also click Create in the right corner, which brings down a dropdown for other features. This is where you'll find Design Documents. When you create a Design Document, it takes you to a new page where you can create a specification for your API using OpenAPI *standards. (*Note: If you are interested in learning more about *OpenAPI *specs, I suggest checking out the Swagger.io documentation.
You can create YAML specs of your API here. Here's a small example using the Swagger Petstore API from the documentation:
Insomnia gives you all the tools you need to rapidly test and build APIs. I hope you found this to be a useful introduction to Insomnia. It has been an indispensable tool for me, and I hope it can be for you as well! If you are interested in learning more from me, don't forget to follow, or check me out on YouTube at