← Back to Chapters

Working with API Responses in Postman

? Working with API Responses in Postman

? Quick Overview

When you send an API request in Postman, the server sends back a response. Understanding the response body, headers, status codes, and response time is essential for debugging, testing, and validating APIs.

? Key Concepts

  • Response Body – Actual data returned by the API
  • Response Headers – Metadata about the response
  • Status Code – Result of the request
  • Response Time – Time taken to get a response

? Syntax / Theory

In Postman, every API response is divided into multiple tabs. Each tab provides specific information about how the server handled your request.

? Code Example(s)

? View Code Example
// Sample JSON response returned from an API
{
  "id": 101,
  "name": "Laptop",
  "price": 55000,
  "inStock": true
}

? Live Output / Explanation

Response Breakdown

  • Status: 200 OK
  • Body: JSON object with product details
  • Headers: Content-Type, Date, Server
  • Time: 120 ms

? Interactive Example

Send a GET request to a public API such as:

? View Code Example
// Public API endpoint used for testing responses
https://jsonplaceholder.typicode.com/posts/1

Observe the response body, headers, status code, and response time directly in Postman.

GET
Status: --
Time: -- ms
Size: -- B
// Click 'Send' to simulate a Postman request...

? Use Cases

  • Validating API responses during development
  • Debugging incorrect server behavior
  • Checking performance using response time
  • Automated testing using response values

? Tips & Best Practices

  • Always check status codes before reading the body
  • Use the Pretty view for formatted JSON
  • Verify headers like Content-Type
  • Monitor response time for performance issues

? Try It Yourself

  1. Send a GET request to any public API
  2. Switch between Pretty, Raw, and Preview views
  3. Note the status code and response time
  4. Inspect response headers carefully