Answer
Sending a POST Request with JSON in Postman
Step-by-Step
- ✓Select POST from the method dropdown
- ✓Enter the URL:
https://reqres.in/api/users - ✓Click the Body tab
- ✓Select "raw" radio button
- ✓Select "JSON" from the format dropdown (changes Content-Type to application/json automatically)
- ✓Enter the JSON body:
JSON
{ "name": "John Doe", "job": "QA Engineer" } - ✓Click Send
Expected Response: 201 Created
JSON
{
"name": "John Doe",
"job": "QA Engineer",
"id": "123",
"createdAt": "2026-06-20T10:00:00.000Z"
}
Add a Test Script (Tests Tab)
JavaScript
pm.test("Status code is 201", function () {
pm.response.to.have.status(201);
});
pm.test("Response has id", function () {
const jsonData = pm.response.json();
pm.expect(jsonData.id).to.be.a('string');
});
pm.test("Name matches", function () {
const jsonData = pm.response.json();
pm.expect(jsonData.name).to.eql("John Doe");
});
Tips
- ✓Always set Content-Type: application/json header (Postman does this automatically when you select JSON in Body > raw)
- ✓Use environment variables for dynamic data:
"name": "{{userName}}" - ✓Use Pre-request Scripts to generate dynamic values before sending:
JavaScript
pm.environment.set("userName", "User_" + Date.now());
