DEV Community

Dhairya Bhargava
Dhairya Bhargava

Posted on

How to Test Your First REST API with Postman: A Practical Walkthrough

Every modern web application relies on Application Programming Interfaces (APIs) to exchange data between user interfaces and backend servers. Before writing code to consume an endpoint, verifying how that API responds is essential for preventing unexpected bugs and runtime errors.

Postman is the industry standard for manual API development and testing. It allows developers to construct HTTP requests, configure payloads, inspect response bodies, and verify status codes without writing client-side fetch logic.

This guide walks through sending an HTTP GET request, interpreting response codes, and validating JSON data using a live public endpoint.

Prerequisites

To follow along, you only need:

  • A modern web browser
  • A free Postman account (accessible at postman.com)

Understanding the Target Endpoint

We will test an endpoint provided by JSONPlaceholder, a free REST API designed for development and prototyping. We will query an individual post:

  • HTTP Method: GET
  • Target URL: https://jsonplaceholder.typicode.com/posts/1

A GET request retrieves data from the specified server without modifying any server-side state.

Step 1: Construct the GET Request

  1. In your Postman workspace, click the + icon or open a request tab.
  2. Ensure the HTTP method dropdown is set to GET.
  3. In the request URL bar, enter:
[https://jsonplaceholder.typicode.com/posts/1]
Enter fullscreen mode Exit fullscreen mode

Step 2: Send the Request and Inspect the Output

Click the blue Send button on the right side of the address bar.

Postman executes the network call and populates the response pane directly below the workbench:

Key Response Metrics:

Status Code (200 OK): Located on the right side of the response bar. A 200 series code indicates the server successfully received, understood, and fulfilled the request.

Latency: Displays the round-trip time in milliseconds (e.g., 37 ms), indicating network speed and server response time.

Payload Size: Shows the total transfer weight (e.g., 1.31 KB).

Step 3: Parse the Returned JSON Payload

Under the Body tab, ensure the display format is set to JSON and Pretty. The server returns a structured JSON object representing the requested resource:

{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
Enter fullscreen mode Exit fullscreen mode

The payload contains key-value pairs (userId, id, title, body) ready to be mapped to frontend application state.

Essential HTTP Status Codes

When testing APIs, status codes quickly identify whether an issue lies with your request or the server:

200 OK: The request succeeded and returned the requested payload.

201 Created: A resource was successfully generated on the server (common for POST requests).

400 Bad Request: The request was malformed, had missing parameters, or contained invalid syntax.

401 Unauthorized: Missing or invalid authentication credentials (API key or bearer token).

404 Not Found: The requested endpoint path or specific resource ID does not exist.

500 Internal Server Error: An unhandled error occurred within the remote server logic.

Conclusion

In under five minutes, you tested a live REST endpoint, validated server availability via standard HTTP response codes, and verified payload formatting without writing single lines of application code. Postman isolates API testing from your frontend UI, giving you an immediate sanity check whenever backend behavior behaves unexpectedly.

Top comments (0)