0
0
PostmanHow-ToBeginner ยท 3 min read

How to Send Query Parameters in Postman: Step-by-Step Guide

In Postman, you send query parameters by adding key-value pairs in the Params tab of your request. These parameters are appended to the URL and sent with your HTTP request automatically.
๐Ÿ“

Syntax

In Postman, query parameters are added as key-value pairs under the Params tab. Each key represents the parameter name, and the value is the parameter's value. Postman automatically appends these to the request URL in the format ?key1=value1&key2=value2.

http
GET https://api.example.com/data?search=books&limit=10
๐Ÿ’ป

Example

This example shows how to send query parameters search and limit in a GET request using Postman.

postman
1. Open Postman and create a new GET request.
2. Enter the URL: https://api.example.com/data
3. Click the <code>Params</code> tab below the URL field.
4. Add two key-value pairs:
   - Key: search, Value: books
   - Key: limit, Value: 10
5. Send the request.

Postman will send the request to: https://api.example.com/data?search=books&limit=10
Output
HTTP/1.1 200 OK Content-Type: application/json { "results": [ {"id": 1, "title": "Book A"}, {"id": 2, "title": "Book B"} ] }
โš ๏ธ

Common Pitfalls

  • Not using the Params tab: Adding query parameters directly in the URL without encoding can cause errors.
  • Incorrect key-value pairs: Misspelling keys or leaving values empty can lead to unexpected API responses.
  • Using POST method with query parameters: While possible, query parameters are usually for GET requests; for POST, use the body tab for data.
http
Wrong way:
GET https://api.example.com/data?search books&limit=10

Right way:
Use Params tab with keys and values properly set as 'search' = 'books' and 'limit' = '10'
๐Ÿ“Š

Quick Reference

StepAction
1Open Postman and create a new request
2Enter the base URL without query parameters
3Click the Params tab below the URL field
4Add key-value pairs for each query parameter
5Send the request; Postman appends parameters automatically
โœ…

Key Takeaways

Use the Params tab in Postman to add query parameters as key-value pairs.
Postman automatically appends query parameters to the URL when sending the request.
Avoid adding query parameters manually in the URL to prevent encoding errors.
Query parameters are mainly used with GET requests; use the body for POST data.
Double-check keys and values to ensure correct API responses.