Use Existing Insomnia Collections with Monika to Monitor your APIs

Denny Pradipta
Hyperjump Tech
Published in
4 min readFeb 18, 2022
Photo by Douglas Lopes on Unsplash

For those who haven’t heard about Insomnia, which is very unlikely, Insomnia is a collaborative API client and design tool to build and test APIs quickly. To put it simply, it’s pretty much like Postman.

If we compare it with Postman, it doesn’t have such glamorous features as Postman collections monitoring. Of course, because Insomnia is just an API client and design tool, we understand. But guess who can do API monitoring besides Postman? Monika. In the latest version of Monika, you can run Monika with Insomnia collection.

This article will show you how to use your existing Insomnia collections with Monika so you can create your own “Insomnia collections monitoring” at home. So, without further ado:

Let’s do this

Run Insomnia Collection with Monika

What is Monika? Monika is an open-source and free synthetic monitoring command-line application. The name Monika stands for “Monitoring Berkala”, which means “periodic monitoring” in the Indonesian language.

With Monika, you can add as many websites as you want to monitor. You can monitor several conditions such as service outages or slow services. Also, you can configure Monika to send notifications of the incidents on your services through your favorite communication tools like SMTP mail, Telegram, WhatsApp (It’s free!), etc.

Install Monika via npm install -g @hyperjumptech/monika or if you don’t have NPM in your system, you can download the prebuilt binary from our release page. After installing Monika, run monika -v to verify your Monika installation.

Example of Monika version

Export your Insomnia Collection

If you don’t have any Insomnia collection, let’s try to create one. Open Insomnia, and navigate to the Create button at the top right of the window. Then, select a Request Collection. Enter the desired name for the collection, and click Create.

Example created collection

Then, proceed to add a new request by clicking the plus button on the top left of the window and clicking the New Request option. Give the request a name. Then, let’s try to add a simple GET request, with the URL using a mock REST API (e.g https://reqres.in/api/users), and click Send.

Example response of the https://reqres.in/api/users

Now that we can confirm that the API is working, let’s export the collection by clicking the caret down icon beside the collection name at the top left of the window and selecting the Import/Export option. Then, click the Export Data button and select Export the “Your collection name” Collection. After that, select the requests you want to export, select the format to Insomnia export version 4 (JSON/YAML), select the destination folder, and you’re halfway done!

Example of exporting data

Running Monika with exported Insomnia collections

Now that you have installed Monika and exported your Insomnia collection, it’s time to run your API monitoring using Monika. Head to the directory where you exported your Insomnia collection, and run monika --insomnia <your_insomnia_file> in your terminal:

It’s working!

Congratulations! Now you can use Monika as an Insomnia Monitoring, just like Postman!

Closing

Insomnia is another popular REST client that can be used for testing RESTful as well as GraphQL APIs. Because of its simplicity, it may not have such features as collection monitoring like Postman. Using Monika, you can monitor your Insomnia collection just like Postman Monitoring with just one line of command.

If you’re having a problem with using Monika, don’t hesitate to create an issue on Monika’s Github Issue Page. If you like this article, don’t forget to clap and share this article with your friends!

That’s it for today, see you next time!

Have a good day like Ice Cube

Hyperjump is an open-source-first company providing engineering excellence service. We aim to build and commercialize open-source tools to help companies streamline, simplify, and secure the most important aspects of their modern DevOps practices.

--

--

Denny Pradipta
Hyperjump Tech

Full-stack developer who loves to explore new technologies. Uses MongoDB, Express, React, and Node daily. Regularly writing for Hyperjump Technologies.