200-901 Understanding and Using APIs Practice Question
A developer is using Postman to test a Cisco Webex API that creates a room. After running the request, they want to verify that the response status is 200 and that the response body contains a non-null 'id' field. Which Postman test code accomplishes this?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
pm.test('Status code is 200', () => { pm.response.to.have.status(200); }); pm.test('ID exists', () => { pm.expect(pm.response.json().id).to.not.be.null; });
pm.response.to.have.status checks the status; pm.expect and pm.response.json() access the body.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
pm.test('Status code is 200', () => { pm.response.to.have.status(200); }); pm.test('ID exists', () => { pm.expect(pm.response.json().id).to.not.be.null; });
Why this is correct
Correct syntax for both checks.
- ✗
pm.response.to.have.status(200); if(pm.response.json().id) { console.log('exists'); }
Why it's wrong here
Not using pm.test; console.log not a test.
- ✗
pm.expect(pm.response.code).to.equal(200); pm.expect(pm.response.json().id).to.not.be.null;
Why it's wrong here
Missing pm.test wrapper; not recommended.
- ✗
pm.test('Status code is 200', () => { pm.response.to.have.status(200); }); pm.test('ID exists', () => { pm.expect(pm.response.json().id).to.be.null; });
Why it's wrong here
Expects null, which is incorrect.
Go deeper
Related to this question
About these practice questions
This 200-901 question is part of Courseiva's 989-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.