Mastering API Testing with Insomnia

Dmytro Shamenko
2 min readJul 25, 2023

--

It’s time to take a detour from our Wishlist app journey and dive into the world of API testing with Insomnia. This hands-on assignment is designed to let you practice using Insomnia by playing around with a public API — swapi.dev, the Star Wars API.

And remember, as Master Yoda once said, “Do or do not. There is no try.” So, let’s dive in!

A course on Insomnia

Insomnia is a powerful, open-source tool that is used for testing and debugging APIs. It provides an intuitive interface that allows you to send HTTP requests to a server and view the responses.

But it’s not just about sending requests; Insomnia can help you build, document, and collaborate on your APIs. It’s a comprehensive tool that’s designed to meet all your API development needs.

Playing with the Star Wars API

The Star Wars API, also known as SWAPI, is a public API that provides data about the Star Wars universe. It’s a fun and beginner-friendly way to learn how to send requests and interpret responses using Insomnia.

The API has endpoints for different data categories, like films, people, planets, species, starships, and vehicles. You can use these endpoints to retrieve information about a specific Star Wars entity.

A Galaxy of HTTP Requests

Before we proceed, it’s essential to understand the types of HTTP requests you’ll be dealing with:

  1. GET: This is used to retrieve data from a server. For example, you might use a GET request to fetch a list of Star Wars films from the SWAPI.
    2. POST: This is used to send data to a server to create a new entity. However, as SWAPI is a read-only API, we won’t be using POST requests in this exercise.
    3. PUT: This is used to update an existing entity on the server. Again, since SWAPI is read-only, we won’t be using PUT requests.
    4. DELETE: As the name suggests, this is used to delete an entity on the server. This will also not be applicable to our SWAPI exercise

Your Assignment: Explore the Universe

Now that you’re familiar with the basics, your task is to use Insomnia to explore the Star Wars universe. Try sending GET requests to different SWAPI endpoints and examine the responses. How does the data structure change depending on the endpoint? What kind of information can you retrieve?

The Force Will Be With You

Remember, patience you must have, my young Padawan. Mastering APIs and testing tools takes time and practice. But with each request you send, you’re one step closer to becoming an API Jedi. So, jump into your X-wing and start exploring the galaxy! And remember, the Force will be with you, always.

In our next article, we’ll regroup and continue our journey towards building our Wishlist application. Until then, happy exploring!

--

--

Dmytro Shamenko

Software Engineer with more than ten years of experience. Systems Architect expertise. DevOps methodology & Golang fan. www.linkedin.com/in/dmitriyshamenko