API Testing

Testing REST APIs: A Practical Workflow

A concrete request-to-saved-collection workflow for testing REST APIs — methods, headers, bodies, status codes, and where that request lives afterward.

AlleForge TeamAugust 16, 20262 min read

Testing a REST API well is less about knowing what GET and POST mean and more about having a workflow: send something real, read the response correctly, and keep it somewhere you can reuse it. This walks through that workflow directly.

The methods, briefly

  • GET — retrieve a resource. No body.
  • POST — create a resource. Body carries what you're creating.
  • PUT — replace a resource entirely.
  • PATCH — update part of a resource.
  • DELETE — remove a resource.

The distinction that actually matters day-to-day: GET and DELETE typically don't send a body; POST/PUT/PATCH usually do.

A request, end to end

Say you're testing a /users endpoint. A GET request to list users:

GET https://api.example.com/users HTTP/1.1
Authorization: Bearer {{apiToken}}

A POST to create one:

POST https://api.example.com/users HTTP/1.1
Authorization: Bearer {{apiToken}}
Content-Type: application/json
 
{
  "name": "Sam Rivera",
  "email": "sam@example.com"
}

{{apiToken}} here is an environment variable, not a literal value pasted into the request — that's what makes the same request work unmodified against dev, staging, or production.

Reading the response

The status code tells you the category before you even look at the body:

RangeMeaning
2xxSuccess — 200 OK, 201 Created, 204 No Content
3xxRedirect
4xxClient error — the request itself was wrong (400, 401, 404)
5xxServer error — the request was fine, the server failed

A 201 Created from the POST above should come back with the created resource in the body — that response is what you'd inspect to confirm the request actually did what you expected, not just that it didn't error.

Saving it so you don't rebuild it

Once a request works, save it into a Collection instead of leaving it in History to get buried under everything else you send that day. A /users collection holding the GET, POST, PUT, and DELETE for that resource, built once, is reusable every time you touch that part of the API again — including by anyone else in your workspace.

Common mistakes worth checking first

  • Wrong Content-Type — a JSON body without Content-Type: application/json is a common cause of a server rejecting an otherwise-correct request.
  • Auth attached to the request instead of the collection — if every request needs the same token, inherited auth means setting it once instead of on every request.
  • Testing against the wrong environment — check which environment is active before assuming a failing request means the API is broken.

Where this doesn't help

None of this replaces reading the API's actual documentation for what a specific endpoint expects — status codes and methods are conventions, not guarantees that a particular API follows them consistently.

See this in AlleForge

Open API Testing