Skip to main content
DevTool House
Back to Blogs
Developer Guides

How to Test a REST API Without Postman: 4 Lightweight Ways

Test a REST API with an online tester, curl, a VS Code .http file or a short Node script, and check what actually matters beyond a 200 OK.

By Wali UllahNovember 23, 20268 min read
A glass terminal window with a green 200 OK badge and 3D curly braces, for testing REST APIs without Postman

You do not need Postman to test a REST API. For most day-to-day checks, an online API tester, a one-line curl command, a .http file in VS Code or a 20-line Node script is faster, uses no extra RAM and leaves nothing to sync. I use all four, depending on whether I am poking at a third-party API, debugging my own backend, or turning a check into something I can run again tomorrow.

This guide shows each method with commands you can copy, and, more importantly, what to actually check, because "it returned 200" is where most API testing stops and most bugs hide.

What you are really checking when you test an API

Before picking a tool, know what a good test looks at. For every request I check five things:

  1. Status code. Not just "2xx", but the right one: 201 Created after a POST that creates something, 204 No Content after a DELETE, 401 when the token is missing, 404 for an ID that does not exist.
  2. Response headers. Content-Type should match the body (application/json, not text/html from an error page). Look for Cache-Control, rate-limit headers such as RateLimit-Remaining or X-RateLimit-Remaining, and Location after a create.
  3. Body shape. The fields your frontend relies on exist, have the right types, and are not null when they should not be. A 200 with {"success": false} inside is still a failure.
  4. Error responses. Send bad input on purpose. A good API returns a 400 with a message that names the bad field, not a 500 with a stack trace.
  5. Timing and size. A response that takes 3 seconds or weighs 2 MB works in testing and hurts in production.

Keep this list in mind for every method below.

Method 1: An online API tester (no install)

When I just need to see what an endpoint returns, an online tester is the quickest option: paste the URL, pick the method, add headers, send.

With the DevTool House API Request Tester:

  1. Choose the method (GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS).
  2. Paste the full URL, including https://.
  3. Add headers such as Authorization: Bearer <token> or Accept: application/json.
  4. For POST, PUT and PATCH, paste a JSON body.
  5. Send, then read the status, response headers, body, time and size.

Two details matter with any online tester:

  • CORS does not apply. The request is sent from the tester's server, not from your browser, so an API that blocks your frontend with a CORS error can still answer here. That makes an online tester a useful way to separate "the API is broken" from "the API does not allow my site's origin".
  • It cannot reach localhost. Your laptop's local server is not on the public internet. To test a local API, use curl or a .http file on your own machine, or expose the port through a tunnel.

If the response is a long single line of JSON, paste it into the JSON Formatter to read it properly.

Method 2: curl, the tool that is already installed

curl ships with macOS, Linux and Windows 10 and later, so it works on every machine I touch, including servers over SSH.

A GET request that also prints the response headers (-i):

curl -i https://api.github.com/zen

A JSON POST request:

curl -i -X POST https://api.example.com/v1/orders \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"productId": 42, "quantity": 2}'

Timing, without the body:

curl -s -o /dev/null -w "status %{http_code}, %{time_total}s, %{size_download} bytes\n" https://api.github.com/zen

Three habits that save time with curl:

  • Keep secrets in variables. $TOKEN keeps the token out of your shell history and out of screenshots.
  • Use -v when something is off. It shows the request headers curl actually sent, the TLS handshake and any redirects, which is where most "works in the browser but not in curl" puzzles are solved.
  • On Windows PowerShell 5.1, type curl.exe. In that version curl is an alias for Invoke-WebRequest, which takes different options. PowerShell 7 removed the alias.

Method 3: A .http file in VS Code

For my own projects I keep a requests.http file next to the code. With the REST Client extension for VS Code, each request gets a "Send Request" link, and the file lives in Git like everything else, so the next developer gets working examples for free. JetBrains IDEs read the same format with their built-in HTTP client.

@baseUrl = http://localhost:8080/api/v1
@token = paste-a-dev-token-here

### Health check
GET {{baseUrl}}/health

### Create an order
POST {{baseUrl}}/orders
Content-Type: application/json
Authorization: Bearer {{token}}

{
  "productId": 42,
  "quantity": 2
}

### Missing token should return 401
POST {{baseUrl}}/orders
Content-Type: application/json

{ "productId": 42, "quantity": 2 }

The ### line separates requests. Variables at the top let you switch between local and staging by changing one line. Because this runs on your machine, localhost works.

Method 4: A small Node script with real assertions

When I want a check I can rerun before every deploy, I write it as a script. Node 18 and later have fetch built in, and node:assert is part of the standard library, so there is nothing to install:

// api-smoke-test.mjs  ->  run with: node api-smoke-test.mjs
import assert from 'node:assert/strict';

const BASE = 'https://jsonplaceholder.typicode.com';

const res = await fetch(`${BASE}/posts/1`);
assert.equal(res.status, 200);
assert.match(res.headers.get('content-type'), /application\/json/);

const post = await res.json();
assert.equal(post.id, 1);
assert.equal(typeof post.title, 'string');

const missing = await fetch(`${BASE}/posts/999999`);
assert.equal(missing.status, 404);

console.log('All API checks passed');

If any assertion fails, the script exits with an error and prints what was expected and what came back. That is exactly what you want in a CI step or a pre-deploy checklist. When the checks grow, move them into your test runner (Jest, Vitest, or Node's own node --test) without changing the idea.

Test the unhappy paths too

Most API bugs show up when something is wrong, not when everything is right. For each important endpoint, I send at least these on purpose:

What to send What a good API returns
No Authorization header 401 Unauthorized
A valid token for a user without access 403 Forbidden
An ID that does not exist 404 Not Found
A required field missing, or a wrong type 400 Bad Request (or 422) naming the field
The wrong method, such as DELETE on a read-only route 405 Method Not Allowed
Many requests in a short burst 429 Too Many Requests, ideally with Retry-After

If any of these returns 500, you have found a bug before your users did.

Common mistakes when testing APIs

  • Forgetting Content-Type: application/json. Many frameworks only parse the body as JSON when this header is present. Without it, the server sees an empty body and you get a confusing validation error.
  • A redirect that turns POST into GET. Calling http:// instead of https://, or adding or removing a trailing slash, can trigger a 301 or 302 redirect. Browsers and most HTTP clients follow those by sending the next request as a GET, so your body disappears. Use the exact final URL.
  • Copying a token with a line break. A token pasted from a terminal or a chat app often carries a hidden newline or space, and the server rejects it. If a token that should work returns 401, paste it into the JWT Decoder to check that it decodes cleanly and has not expired.
  • Only checking the status. As above, read the body. A 200 with an error object inside is still an error.

FAQ

How do I check if an API is working?

Send a simple GET request to a known endpoint (many APIs have /health or /status) and check three things: the status code is 200, the Content-Type is what you expect, and the body contains real data rather than an error message. An online API tester or curl -i <url> shows all three in one step.

Is there a free online alternative to Postman?

Yes. For one-off requests, an online API tester such as the DevTool House API Request Tester needs no account or install. For collections you want to keep, a .http file with the VS Code REST Client extension is free, works offline, and lives in your Git repository.

Can I test a localhost API with an online tool?

Not directly. An online tester sends the request from its own server, which cannot reach your machine's localhost. Use curl, a .http file, or a Node script locally, or expose the port with a tunnelling tool if you really need to reach it from outside.

Why does my API work in Postman but not in the browser?

Usually CORS. Postman, curl and online testers do not enforce CORS, but browsers do. If your frontend gets a CORS error while other tools work, the API is reachable; it just does not include your site's origin in its Access-Control-Allow-Origin response header.

How do I test a POST request online?

Choose POST in the tester, add a Content-Type: application/json header, paste the JSON body, and send. Then check that the status is 201 or 200 and that the response contains the object you created.

Try the related tools

Related articles