■ Postman for API Testing – Study Guide
Mastering Postman
Postman is one of the most popular tools for API development, testing, and automation. It
provides a user-friendly interface to send requests, inspect responses, organize collections,
and even automate workflows.
Introduction to Postman
What is Postman?
- A platform to test REST, SOAP, and GraphQL APIs.
- Provides GUI for sending API requests.
Why use it?
- Easy request building.
- Reusable collections.
- Environment variables.
- Automation and testing.
Making API Calls
Steps:
1. Open Postman → Click New Request.
2. Select the HTTP method (GET, POST, PUT, DELETE, PATCH).
3. Enter the API endpoint (URL).
4. Click Send.
Example:
GET request: [Link]
Managing Path and Query Parameters
Path Parameters:
/users/{id}, e.g., /users/101
Query Parameters:
/users?id=101&status;=active
In Postman:
- Path parameters entered in URL (/users/{{userId}}).
- Query parameters added in Params tab.
Setting Headers and Passing Payloads
Headers:
- Content-Type: application/json
- Authorization: Bearer
Payloads (Body Data):
In POST/PUT → Body → raw → JSON.
Example:
{
'name': 'Swastik',
'role': 'Tester'
}
Response Status Codes and Message Verification
Common Status Codes:
- 200 OK → Successful
- 201 Created → Resource created
- 400 Bad Request → Invalid input
- 401 Unauthorized → Authentication required
- 404 Not Found → Resource missing
- 500 Internal Server Error
In Postman Tests tab:
[Link]('Status code is 200', function () {
[Link](200);
});
Understanding Response Headers
Response headers provide info about server, content, caching.
Examples:
- Content-Type: application/json
- Date: Tue, 15 Aug 2025 10:00:00 GMT
- Server: nginx
Useful for debugging API issues.