Postman or Insomnia for Testing Axum APIs

Learn how to install and use Postman or Insomnia to send HTTP requests, organize your API testing workflow, and get ready to test Axum servers.

Postman and Insomnia are two of the most widely used graphical tools for testing APIs. Instead of typing commands into a terminal, you get a visual interface where you can build requests, inspect responses, and save your work for later. This page walks through what these tools do, how to install them, and how to use their most important features so that you can test any Axum server you build later in this course.

What Is a GUI API Client?

A GUI API client is a desktop application that lets you send HTTP requests to a server using buttons, forms, and text fields instead of writing command‑line commands. GUI stands for Graphical User Interface - the part of a program you can see and click. An API client is simply a program that talks to an API on your behalf.

When you work with a backend framework like Axum, you create routes that handle requests. For example, your Axum app might listen for GET /health and return {"status": "ok"}. You need a way to send that request and see the response. Command‑line tools like curl or HTTPie work, but they require you to remember syntax and copy long commands. A GUI client shows you the request details in a clean layout, lets you change one field at a time, and displays the response with color‑coded JSON. That makes learning and debugging much easier.

Postman and Insomnia both fit this description. They are not part of Rust or Axum - they are separate applications that run on your computer and send HTTP requests to any server, including your local Axum development server.

Why Use Postman or Insomnia Instead of curl

You already have access to curl and HTTPie from the command line. Those tools are powerful, but for a beginner they hide important details. In a GUI client you can see the URL, method, headers, query parameters, and body all at once. You can change a header and send the request again with one click. You can save a request and reuse it tomorrow without retyping anything.

Another advantage is organization. When you test an API with many endpoints, you need a way to group related requests. Postman and Insomnia let you put requests into collections - folders that hold all the calls for one project. You can also define environment variables so you don't have to change the base URL in every request when you switch from your local machine to a staging server.

These tools also simplify authentication. Many APIs require an API key or a token in a header. You can store that token in an environment variable once and use it across every request in your collection.

Postman vs Insomnia - Two Sides of the Same Coin

Postman has existed longer and has a very large community. It includes many built‑in features like automated testing, mock servers, and team collaboration. Some of those features require a paid plan, but the free tier is more than enough for learning and local development.

Insomnia is a smaller, more focused tool. Its interface is cleaner and less crowded. The free version includes all the core request‑building features you need. Insomnia offers a Local Vault that keeps your data on your machine, while Postman syncs your saved collections to its cloud service once you sign in - which it requires before you can save collections at all.

You do not need both. Pick one, install it, and learn it well. All the concepts you learn in one tool transfer to the other. The rest of this page shows both side by side so you can follow the tool you chose.

No Wrong Choice:

Both tools are excellent for testing Axum APIs. If you want the smallest, simplest interface, start with Insomnia. If you expect to use advanced testing features later or see Postman used in job posts, start with Postman.

Installing Postman

Postman is available for Windows, macOS, and Linux. The steps below assume you have a computer with a normal user account and an internet connection.

1

Step 1: Download the Installer

Open your web browser and go to the official Postman download page at https://www.postman.com/downloads/. The website detects your operating system and shows the correct download button. Click it to download the installer file. On Windows this is a .exe file, on macOS a .zip file, and on Linux a .tar.gz archive.

2

Step 2: Run the Installer

Find the downloaded file and open it. On Windows, double‑click the .exe and follow the on‑screen prompts. On macOS, unzip the file and drag the Postman app into your Applications folder. On Linux, extract the archive and run the Postman executable from the extracted folder.

3

Step 3: Create or Sign In to an Account

When Postman starts, it asks you to sign in or create a free account. You need a free account to save collections, environments, and variables - the old Scratch Pad mode that let you work without an account was retired in 2023. Without signing in, you can still send individual requests with the lightweight API client, and your request history is stored locally, but anything you want to keep requires the account. Creating a free account also lets you sync your work online and access it from other computers.

Postman Is Ready:

Once you see the main Postman window with a list of options on the left and a large request builder on the right, the installation succeeded. You can now send your first request.

Installing Insomnia

Insomnia is also cross‑platform and the installation is similar to Postman.

1

Step 1: Download the Installer

Visit the official Insomnia download page at https://insomnia.rest/download. The site shows a button for your operating system. Download the installer.

2

Step 2: Install the Application

On Windows, run the downloaded .exe and follow the installer. On macOS, open the .dmg file and drag Insomnia into Applications. On Linux, you can use an AppImage or a .deb package depending on your distribution.

3

Step 3: Create an Account and Choose Local Vault

Insomnia will ask you to create a free account. Since Insomnia 8.0, an account is required for full use: without one, you only get a single local Scratch Pad collection. Once signed in, you can choose how your data is stored - Local Vault keeps everything on your machine, while Git Sync and Cloud Sync store it remotely. For learning, pick Local Vault after signing in.

Insomnia Is Ready:

The main Insomnia window shows a sidebar with an empty collection and a blank request area. That means you are ready to create your first request.

Sending Your First GET Request

Now let's send a real HTTP request. We'll use a public test API that returns fake data, so you don't need an Axum server running yet. The URL is https://jsonplaceholder.typicode.com/todos/1. This service responds to GET requests with a small JSON object representing a to‑do item.

In Postman, click the New button in the top left and choose HTTP Request. A new tab opens. In the field that says "Enter request URL", type:

https://jsonplaceholder.typicode.com/todos/1

The method is already set to GET (you can see it in the dropdown to the left of the URL field). Click the blue Send button on the right.

The lower part of the window now shows the response. You should see a Status of 200 OK and a JSON body that looks like this:

{
  "userId": 1,
  "id": 1,
  "title": "delectus aut autem",
  "completed": false
}

The 200 OK status means the server understood the request and returned the data successfully. The JSON object is the response body. Both tools format JSON automatically, so the indentation and colors help you read it.

Check the Status Code First:

Beginners often look only at the body and ignore the status code. Always check the status number before reading the data. A 404 Not Found with a JSON body still means the request failed because the URL was wrong.

Understanding Query Parameters

Query parameters are extra pieces of information you add to the end of a URL after a question mark. They look like ?key=value. For example, the JSONPlaceholder API can filter todos by user: https://jsonplaceholder.typicode.com/todos?userId=1 returns only the todos belonging to user 1.

In a GUI client, you do not have to type the whole URL with the question mark. Both tools give you a Params tab where you can enter each key and value separately. The tool builds the full URL for you.

With the previous request still open, click the Params tab just below the URL field. You'll see a table with columns for Key and Value. Click the empty row and type userId in the Key column and 1 in the Value column. The URL field at the top updates automatically to:

https://jsonplaceholder.typicode.com/todos?userId=1

Click Send. The response now contains only todos with "userId": 1. If you look at the response, you'll see multiple items in an array, not just one.

When you need more than one parameter, you add another row. The tool joins them with an ampersand (&). For example, ?userId=1&completed=false would appear if you added a second parameter called completed with value false.

Parameters vs Path Segments:

A query parameter appears after ? and is optional. A path segment is part of the URL before ?, like the /1 in /todos/1. Path segments usually identify a specific resource, while query parameters filter or sort a list. In a GUI client, path segments are typed directly into the URL field; query parameters go in the Params/Query tab.

Sending a POST Request with a JSON Body

A GET request asks the server for data. A POST request sends data to the server to create a new resource. The data goes in the request body. For JSON APIs, the body is a JSON object and you must set the Content-Type header to application/json so the server knows how to parse it.

We'll use the same JSONPlaceholder service. The endpoint POST https://jsonplaceholder.typicode.com/posts expects a JSON body with title, body, and userId fields. The server will return the created post with an id added.

Create a new HTTP request. Set the method to POST using the dropdown. Enter the URL:

https://jsonplaceholder.typicode.com/posts

Now click the Body tab below the URL. Select the raw radio button. A dropdown appears to the right; choose JSON from it. In the large text area, type the following JSON:

{
  "title": "Learn Axum",
  "body": "Building a REST API with Rust and Axum",
  "userId": 1
}

Postman automatically adds the Content-Type: application/json header when you select JSON. Click Send. The response status is 201 Created and the body contains the same fields plus an id like 101.

The 201 Created status tells you the server created the resource. Some APIs return 200 OK for POST requests instead, but 201 is the standard for creation. The response body often echoes your input and adds server‑generated fields like id.

Forgetting the Content-Type Header:

If you paste JSON into the body but do not set the Content-Type header to application/json, many servers will return a 400 Bad Request or ignore the body. In Postman and Insomnia, selecting the JSON body type usually sets the header for you, but always check the Headers tab if you get an error.

Adding Custom Headers

HTTP headers are key‑value pairs that carry metadata about the request. Examples are Authorization for tokens, Accept for the format you want back, and Content-Type for the format you are sending. In a GUI client you can add any header you need.

Suppose an API requires an authentication token in the Authorization header. You can add that header without typing the full HTTP syntax.

Open any request and click the Headers tab. Below the automatically added headers, click the empty row. In the Key column type Authorization, and in the Value column type Bearer my-secret-token. If the row does not appear, click the "Add row" link.

Click Send. The server receives the header exactly as you entered it. To verify, you can send a request to https://httpbin.org/headers and check the response; it echoes all headers the server saw.

Some headers are built into the tools. For example, Content-Type is often set automatically when you choose a body type. You can still override it in the Headers tab.

Using Environment Variables

When you test an API, you often send requests to the same base URL many times. That base URL might be http://localhost:3000 during development and https://api.example.com in production. Instead of editing every request when the URL changes, you store the base URL in an environment variable and use {{baseUrl}} in your request URL.

Both Postman and Insomnia support environments. You define variables once, then reference them inside double curly braces.

In Postman, look at the top right of the window. There is an environment dropdown. Click it and choose Manage Environments. Click Add to create a new environment. Name it "Local Dev". Add a variable named baseUrl with initial value http://localhost:3000 and current value the same. Click Save, then close the dialog. Select the new environment from the dropdown.

Now in any request URL, type {{baseUrl}}/health. When you click Send, Postman replaces {{baseUrl}} with http://localhost:3000, so the actual URL becomes http://localhost:3000/health.

You can also use environment variables in headers and bodies. For example, an Authorization header value can be Bearer {{token}}.

Environment variables are especially useful for tokens that change frequently. Store the token once, then reference it in every request. When the token expires, update the environment instead of editing many requests.

You Know You've Set It Up Correctly:

After defining baseUrl and using it in a request, hover over the URL field in either tool. It should show a tooltip or preview with the full expanded URL. If it does not, the variable name may be misspelled. Check the case and spelling exactly.

Organizing Requests into Collections

A collection is a folder that holds related requests. For an Axum project, you might have a collection called "Todo API" with requests like "Get all todos", "Create todo", "Update todo", and "Delete todo". Grouping requests keeps your workspace tidy and lets you run a sequence of requests automatically in Postman.

Collections need a free account:

In both tools, collections (and environments) require signing in to a free account: Postman needs the account to save anything at all, and Insomnia needs it for anything beyond its single local Scratch Pad collection. The steps above cover signing in for each tool.

In the left sidebar, click the Collections tab. Click the + button next to "Collections" or choose New > Collection. Name it "Todo API". You can add a description if you like. Click Create.

Now when you create a new request, you can select that collection from the "Save to" dropdown, or you can drag an existing request into the collection folder. To save an unsaved request, click the Save button (a disk icon) and choose the collection.

A collection can also store common settings like authentication and headers that apply to all requests inside it. Both tools allow you to set collection‑level variables and auth.

Saving and Reusing Responses

When you send a request, the response appears in the lower pane. You can save the response body to a file or copy it to the clipboard. More importantly, you can save the request itself so you can run it again later without retyping the URL, headers, and body.

In both tools, an unsaved request usually has a dot or an asterisk next to its name. Save it before closing the tab or the tool, or your work is lost.

To save a request, click the Save button (floppy disk icon) in the top right of the request tab. Choose a collection and give the request a name. The tab now shows the name without a dot, and the request appears in the collection list on the left.

To save a response, look in the response pane. There is a Save Response button (down arrow). You can save it as a file or as an example attached to the request. Examples are useful for documentation.

Having saved requests means you can close the app, reopen it, and continue testing where you left off. This is a huge advantage over typing curl commands again and again.

Common Mistakes and How to Avoid Them

Working with a GUI client eliminates many command‑line errors, but beginners still run into a few predictable problems.

Forgetting to select the environment. If you use {{baseUrl}} in your URL but no environment is selected, the tool sends the literal string {{baseUrl}} as part of the URL. This causes a DNS error or a 404. Always check the environment dropdown.

Not setting the request method correctly. The default method is often GET. If you need to send a POST but forget to change the dropdown, the server might return a 404 because there is no GET route for that endpoint. Double‑check the method.

Sending JSON without the correct header. The server may not parse the body, leading to empty data or an error. Select JSON as the body type; the tool adds the header for you.

Typing the URL with a trailing slash when the server doesn't expect it. For example, http://localhost:3000/health/ is not the same as http://localhost:3000/health unless the server treats them equally. Axum routes are usually defined without a trailing slash.

Testing a server that isn't running. If you send a request to localhost:3000 and get "Could not connect" or ECONNREFUSED, your Axum app is not running. Start the server, then resend.

The Most Common Beginner Error:

The single most frequent mistake is not checking the environment before sending a request with variables. The URL looks correct in the field, but if the environment is not selected, the variables remain as {{name}}. The request fails in a confusing way. Always verify the environment dropdown shows the right name.

Testing an Axum API with Postman or Insomnia

Once you have a running Axum server, the workflow is identical to what you practiced with JSONPlaceholder. The only difference is the base URL. If your Axum app listens on 127.0.0.1:3000, you would use http://127.0.0.1:3000 or http://localhost:3000 as the base.

For example, if your Axum app has a health route that returns {"status":"ok"} at GET /health, you create a new request, set the method to GET, set the URL to http://localhost:3000/health, and click Send. The response appears in the GUI.

If your Axum app expects a JSON body on POST /todos, you set the method to POST, the URL to http://localhost:3000/todos, choose JSON body, and enter the JSON that matches your handler's expected structure. The GUI client sends the request exactly as configured.

The key point is that Postman and Insomnia are general HTTP clients. They do not care what language the server is written in. Axum, Express, Django, or anything else - the request is the same.

Summary

The most important takeaway is not the specific buttons but the mental model: every HTTP request has a method, a URL, optional headers, and an optional body. A GUI client makes those four pieces visible and editable, and collections and environments are just ways to save those four pieces and reuse them with different values. Once that model clicks, the two tools become interchangeable - the same request built in Postman works the same way in Insomnia, and the same request typed into HTTPie or curl sends the same bytes.

If you have not yet chosen a tool, try both for a day and keep the one whose layout you stop noticing. The right choice is the one that stays out of your way while you verify each route you build. When you start building Axum APIs, that tool becomes the place you confirm a route exists, a handler accepts the right JSON, and an error returns the status code you intended - before any other code depends on it.