Skip to lesson

Postman: your first requests

You built a REST API and must try it before any app exists. A browser address bar sends only GET and hides the headers, so you need a tool that sends any request and shows the whole answer.

Installing Postman and creating a workspace

A workspace is a named space inside Postman that keeps one project's requests, collections, environments and history together.

Install Postman, then create a workspace for ShopLite so its requests stay together. The optional commands below install Postman from a terminal.

Terminal
# Optional: install from the terminal instead of the website# Windows (PowerShell or Command Prompt)winget install --id Postman.Postman -e# macOS (with Homebrew)brew install --cask postman
  1. Open Postman and sign in, or create a free account with your email.
  2. Click Workspaces in the top bar, then Create Workspace.
  3. Choose Blank workspace, name it ShopLite, keep it private (only you), and click Create.
  4. Check the workspace name in the top-left corner: everything you make now lands in ShopLite.

Postman is a free app from postman.com/downloads. It asks you to sign in with a free account, which saves your work and syncs it across computers. Quick requests work without an account, but collections, environments and the Collection Runner need one.

On Windows, run the downloaded .exe installer; if SmartScreen warns, check that the file came from postman.com, then click More info and Run anyway. On macOS, pick Mac Apple Chip or Mac Intel Chip (Apple menu, About This Mac), unzip the file and drag Postman.app into Applications; click Open when macOS asks. Screens change between versions, so look for the names Workspaces, Params, Send and History if a button has moved.

Building a GET request: URL, query params table, Send

The Params tab is a Key and Value table of a request's query parameters. It stays in sync with the URL: typing ?categoryId=4 fills the table, and editing the table changes the URL.

The examples call the ShopLite practice API at http://localhost:8080/api/v1. Click + for a new tab, keep GET, type the URL, add parameters in Params and click Send.

Example 1 · A GET request with two query parameters

Text
GET  http://localhost:8080/api/v1/products?categoryId=4&sort=price,ascParams tab  KEY        VALUE  categoryId 4  sort       price,asc
Response (Body tab, Pretty)
Status: 200 OK

{
    "content": [
        {
            "id": 8,
            "sku": "ACC-M331",
            "name": "Logitech M331 Silent Mouse",
            "categoryId": 4,
            "categoryName": "Accessories",
            "price": 849.00,
            "stock": 0,
            "isActive": true
        },
        {
            "id": 6,
            "sku": "ACC-AD141",
            "name": "boAt Airdopes 141",
            "categoryId": 4,
            "categoryName": "Accessories",
            "price": 1299.00,
            "stock": 120,
            "isActive": true
        },
        {
            "id": 7,
            "sku": "ACC-PB20K",
            "name": "Mi Power Bank 20000mAh",
            "categoryId": 4,
            "categoryName": "Accessories",
            "price": 2199.00,
            "stock": 60,
            "isActive": true
        }
    ],
    "page": 0,
    "size": 20,
    "totalElements": 3,
    "totalPages": 1
}

What this code does

  • The two rows in the Params table are the ?categoryId=4&sort=price,asc part of the URL. Category 4 is Accessories, sorted from the cheapest up.
  • The body is a page envelope: the products sit in content, and totalElements says 3 matched. Prices come as numbers with two decimals, such as 849.00.

Example 2 · A value with a space: Postman encodes it

Text
GET  http://localhost:8080/api/v1/products?q=power bankParams tab  KEY   VALUE  q     power bankWhat Postman actually sends (open the Console button at the bottom of the window)GET /api/v1/products?q=power%20bank
Response (Body tab, Pretty)
Status: 200 OK

{
    "content": [
        {
            "id": 7,
            "sku": "ACC-PB20K",
            "name": "Mi Power Bank 20000mAh",
            "categoryId": 4,
            "categoryName": "Accessories",
            "price": 2199.00,
            "stock": 60,
            "isActive": true
        }
    ],
    "page": 0,
    "size": 20,
    "totalElements": 1,
    "totalPages": 1
}

What this code does

  • A URL may not contain a raw space, so Postman sends it as %20. The server decodes it back to power bank and searches product names.
  • The search ignores upper and lower case, so power bank matches Mi Power Bank 20000mAh. In curl you must write %20 yourself.

The ShopLite practice API is the online store API from the REST API Design module, with products, categories and login. You build such a server later in the course; any API works the same way in Postman. Ctrl+Enter (Cmd+Enter on a Mac) also sends the request.

Postman encodes special characters for you: a space typed in a value goes out as %20. A long URL with five filters stays readable in the table.

Order of execution

Send your first request

Put the steps in the order you do them in Postman.

Untick a row in the Params table to drop that parameter for one try without deleting it.

Reading the response: status, time, size, body, headers

The response pane is the area under a request that shows what came back: the status, time and size on the top row, then the Body and Headers tabs.

Send a request, then read the response pane from the top row down to the Body and Headers tabs. The examples show a 404 and a 400 with their bodies.

Example 3 · Reading a 404: status, headers and body

Text
GET  http://localhost:8080/api/v1/products/99
Sample output (Headers tab, then Body tab; your Date differs)
Status: 404 Not Found

Content-Type: application/problem+json
Content-Length: 166
Date: Fri, 16 Oct 2026 02:46:17 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{
    "type": "https://shoplite.example/problems/not-found",
    "title": "Resource not found",
    "status": 404,
    "detail": "Product 99 was not found.",
    "instance": "/api/v1/products/99"
}

What this code does

  • The status 404 Not Found shows in red. The Content-Type header is application/problem+json: the Problem Details error format from the REST API Design module.
  • The body says exactly what is missing (Product 99 was not found.) and which URL failed (instance). Always open the body of an error before guessing.
  • Date, Connection and Keep-Alive are added by the server on every response; only Date changes from run to run.

Example 4 · A 400 that explains itself

Text
GET  http://localhost:8080/api/v1/products?size=500Params tab  KEY    VALUE  size   500
Response (Body tab, Pretty)
Status: 400 Bad Request

{
    "type": "https://shoplite.example/problems/validation-failed",
    "title": "Validation failed",
    "status": 400,
    "detail": "The request has 1 invalid field.",
    "instance": "/api/v1/products",
    "errors": [
        {
            "field": "size",
            "message": "must be between 1 and 100"
        }
    ]
}

What this code does

  • The API allows at most 100 items per page, so size=500 is rejected with 400 Bad Request instead of being quietly cut down.
  • The errors list names the parameter and the rule it broke. Change the value in the Params table to 100 and send again: the status becomes 200 OK.

The top row shows the status (200 OK in green, 404 Not Found in red), the time (such as 12 ms) and the size, headers plus body (such as 412 B). Hover over each one for details: the time splits into DNS lookup, TCP handshake and download.

In the Body tab, Pretty formats JSON, Raw shows the exact text the server sent and Preview renders HTML. The Headers tab lists headers such as Content-Type and Location. Always read both: the status says what happened and an error body says why. A body can look fine while the status says 404, and an empty list with 200 OK means "no matches", not "broken".

Predict the output

Read the response

Read each response and pick what it tells you.

Round 1 of 2

GET /api/v1/products?q=keyboard
Status: 200 OK
{ "content": [], "totalElements": 0 }

History, and saving a request

History is an automatic log of every request you sent, grouped by day with the newest first. Click one to open it again exactly as it was sent.

History is only a log, so save a request you want to keep. The Code button then turns it into a curl command.

Example 5 · The Code button: the same request as curl

Terminal
curl --location 'http://localhost:8080/api/v1/products/6'
Output
{"id":6,"sku":"ACC-AD141","name":"boAt Airdopes 141","categoryId":4,"categoryName":"Accessories","price":1299.00,"stock":120,"isActive":true}

What this code does

  • This is the command Postman generates for a saved GET .../products/6 request when you pick cURL in the Code panel. --location tells curl to follow redirects, as Postman does by default.
  • curl prints the raw body, all on one line, exactly as the server sent it. Postman's Pretty view only adds line breaks and indentation for reading.

History is the clock icon in the left sidebar. To keep a request on purpose, press Ctrl+S (Cmd+S on a Mac), give it a clear name such as List accessories by price and choose a collection, a named folder of requests. Saved requests keep their name, URL, params and headers, and you can share them with your team.

The Code button (the </> icon in the right sidebar) turns the open request into code in many languages. Choose cURL to get a command for a terminal, a bug report or a chat message.

Postman alternatives in one line: Bruno, Insomnia, IDE HTTP clients

An HTTP client is a tool that sends HTTP requests and shows the full response. Postman, Bruno, Insomnia, IDE .http files and curl are all HTTP clients.

Postman is the most common HTTP client, but the same request works in the others. Only the screens differ; the .http file below is one example.

Example 6 · The same request in an IDE HTTP client (.http file)

Text
### Category 4GET http://localhost:8080/api/v1/categories/4Accept: application/json
Response
Status: 200 OK

{
    "id": 4,
    "name": "Accessories",
    "parentId": 1
}

What this code does

  • A .http file holds requests as plain text: ### starts a request, then the method and URL, then header lines. IntelliJ IDEA and the VS Code REST Client extension show a run button next to each request.
  • Because it is a text file, it can live in your project and go into Git, much like Bruno's files.

Each of these sends the same HTTP requests and shows the same responses:

  • Bruno: free and open source, keeps each request as a plain text file in your project folder, so Git tracks it like code. No account needed.
  • Insomnia: a desktop app much like Postman, with a clean screen and good GraphQL support.
  • IDE HTTP clients: a .http file of requests that you run from the editor, built into IntelliJ IDEA and available in VS Code through the REST Client extension.
  • curl: the command-line tool from the HTTP lessons, already on Windows 10+ and macOS. The curl recipes lesson in this module goes deeper.

Next step

Check your understanding

12 quick questions