Challenge - 5 Problems
POST Request Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the response status code for this POST request?
Consider this Postman test script snippet that sends a POST request to create a new user. What will be the status code in the response if the user is created successfully?
Postman
pm.test('Status code is 201', function () { pm.response.to.have.status(201); });
Attempts:
2 left
💡 Hint
201 means resource created successfully.
✗ Incorrect
HTTP status code 201 means the POST request successfully created a new resource.
❓ assertion
intermediate2:00remaining
Which assertion correctly verifies the JSON response contains the new user's id?
You send a POST request to create a user. The response JSON contains an 'id' field. Which Postman test assertion correctly checks that the 'id' field exists and is not null?
Attempts:
2 left
💡 Hint
The id should exist and not be null or undefined.
✗ Incorrect
Option A correctly asserts that the 'id' field exists in the JSON response.
🧠 Conceptual
advanced2:00remaining
What is the main purpose of using POST requests in API testing?
In API testing, why do we use POST requests instead of GET requests?
Attempts:
2 left
💡 Hint
POST is used to send data to the server to create something new.
✗ Incorrect
POST requests are used to create new resources or submit data to the server.
🔧 Debug
advanced2:00remaining
Why does this Postman test fail when checking the response body?
Given this test script after a POST request, why does it fail?
pm.test('Response has name', function () {
pm.expect(pm.response.text()).to.include('name');
});
Attempts:
2 left
💡 Hint
Check if the response is parsed JSON or plain text.
✗ Incorrect
pm.response.text() returns the raw response as a string. To check JSON fields, parse it first.
❓ framework
expert3:00remaining
Which Postman test script correctly validates a POST response with nested JSON and status 201?
You send a POST request that returns a JSON response with this structure:
{
"user": {
"id": 123,
"profile": {
"email": "test@example.com"
}
}
}
Which test script correctly asserts the status is 201 and the email is 'test@example.com'?
Attempts:
2 left
💡 Hint
Check the JSON path and status code carefully.
✗ Incorrect
Option B correctly checks status 201 and accesses nested email field properly.