0
0
Postmantesting~5 mins

Query parameters in Postman

Choose your learning style9 modes available
Introduction

Query parameters help send extra information to a web server in a simple way. They let you filter or customize the data you get back.

When you want to search for specific items in a list, like finding books by a certain author.
When you need to sort data, for example, showing newest products first.
When you want to limit how many results you get, like showing only 10 users per page.
When you want to filter results, such as only showing active users.
When testing APIs to check how they handle different inputs without changing the main URL.
Syntax
Postman
https://api.example.com/resource?key1=value1&key2=value2

Query parameters come after a question mark (?) in the URL.

Multiple parameters are separated by an ampersand (&).

Examples
This URL asks for users who are 25 years old.
Postman
https://api.example.com/users?age=25
This URL asks for products in the 'books' category, sorted by price from low to high.
Postman
https://api.example.com/products?category=books&sort=price_asc
This URL searches for the word 'testing' in the data.
Postman
https://api.example.com/search?q=testing
Sample Program

This test checks if the API returns only 5 users who are active.

Postman
GET https://api.example.com/users?status=active&limit=5

// In Postman, set method to GET and enter the URL with query parameters.
// Send the request and check the response for 5 active users.
OutputSuccess
Important Notes

Always encode special characters in query parameters to avoid errors.

Query parameters are case sensitive in most APIs.

Use Postman's Params tab to add query parameters easily without typing them in the URL.

Summary

Query parameters add extra details to a URL to customize API requests.

They start with '?' and use '&' to separate multiple parameters.

They help filter, sort, and limit data returned by APIs.