0
0
Postmantesting~20 mins

GET request in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
GET Request Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the status code returned by this GET request?
You send a GET request to https://jsonplaceholder.typicode.com/posts/1 using Postman. What status code do you expect in the response?
Postman
GET https://jsonplaceholder.typicode.com/posts/1
A500
B404
C301
D200
Attempts:
2 left
💡 Hint
A successful GET request usually returns this status code.
assertion
intermediate
2:00remaining
Which assertion correctly verifies the response body contains a userId of 1?
You receive this JSON response from a GET request:
{"userId": 1, "id": 1, "title": "...", "body": "..."}

Which Postman test script assertion correctly checks that userId equals 1?
Apm.test('UserId is 1', () => { pm.expect(pm.response.json().userId).to.eql(1); });
Bpm.test('UserId is 1', () => { pm.expect(pm.response.userId).to.equal(1); });
Cpm.test('UserId is 1', () => { pm.expect(pm.response.json().userId).to.be(1); });
Dpm.test('UserId is 1', () => { pm.expect(pm.response.body.userId).to.eql(1); });
Attempts:
2 left
💡 Hint
Use pm.response.json() to parse JSON response body.
🔧 Debug
advanced
2:00remaining
Why does this Postman test fail with 'TypeError: Cannot read property'?
Test script:
pm.test('Title exists', () => { pm.expect(pm.response.body.title).to.exist; });

What causes the error?
Postman
pm.test('Title exists', () => { pm.expect(pm.response.body.title).to.exist; });
AThe test script is missing a semicolon causing syntax error.
Bpm.response.body is a string, not an object, so accessing .title causes TypeError.
Cpm.response.body is undefined because the request failed.
DThe assertion method 'to.exist' is invalid and causes the error.
Attempts:
2 left
💡 Hint
Check the type of pm.response.body before accessing properties.
🧠 Conceptual
advanced
2:00remaining
What is the main difference between GET and POST requests in API testing?
Choose the best explanation for the difference between GET and POST requests.
AGET requests send data in the request body; POST requests send data in the URL.
BGET requests always require authentication; POST requests never do.
CGET requests retrieve data without changing server state; POST requests send data to create or update resources.
DGET requests are slower than POST requests because they transfer more data.
Attempts:
2 left
💡 Hint
Think about what each request type is used for in APIs.
framework
expert
2:00remaining
Which Postman test script correctly checks that the response header 'Content-Type' includes 'application/json'?
You want to verify the response header 'Content-Type' contains 'application/json'. Which script is correct?
Apm.test('Content-Type is JSON', () => { pm.expect(pm.response.headers.get('Content-Type')).to.include('application/json'); });
Bpm.test('Content-Type is JSON', () => { pm.expect(pm.response.headers['Content-Type']).to.equal('application/json'); });
Cpm.test('Content-Type is JSON', () => { pm.expect(pm.response.headers.get('content-type')).to.eql('application/json'); });
Dpm.test('Content-Type is JSON', () => { pm.expect(pm.response.headers['content-type']).to.include('application/json'); });
Attempts:
2 left
💡 Hint
Use the correct method to get headers in Postman scripts and check inclusion.