200-901 Understanding and Using APIs Practice Question
A developer is building a Python script that calls the Cisco Webex API to create a new room. The API returns a JSON payload containing the room ID. The developer needs to extract the room ID from the response and use it in a subsequent API call to add a member to that room. Which Python code snippet correctly parses the JSON response and extracts the room ID, assuming the response object is stored in a variable named `response` and the JSON key is `id`?
⚠ Common exam trap
A common mix-up: candidates confuse the .json() method with a property, or using .text or .content directly for dictionary access.
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
✓
room_id = response.json()['id']
The correct approach is to use the .json() method provided by the requests library to parse the JSON response into a Python dictionary, then access the 'id' key. This yields the room ID needed for subsequent API calls. The other options incorrectly assume that the response object can be indexed directly or that .json is a property.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
room_id = response.text['id']
Why it's wrong here
response.text returns the raw response body as a string, not a dictionary. Attempting to index a string with a key like 'id' will raise a TypeError. To parse JSON, you must use response.json() or json.loads(response.text). This option would fail at runtime.
- ✓
room_id = response.json()['id']
Why this is correct
This correctly uses the .json() method to parse the JSON response body into a Python dictionary, then accesses the 'id' key. It is the standard way to handle JSON responses in the requests library, which is commonly used for REST API calls. The resulting room_id can be used in subsequent requests.
- ✗
room_id = response.json['id']
Why it's wrong here
response.json is a method, not a property, so it must be called with parentheses: response.json(). Without parentheses, you are attempting to index the method object itself, which will raise a TypeError. This is a common mistake when working with the requests library.
- ✗
room_id = response.content['id']
Why it's wrong here
response.content returns the raw bytes of the response body. Indexing bytes with a string key is invalid and will raise a TypeError. The correct approach is to decode and parse the JSON, typically with response.json(). This option does not correctly handle the JSON structure.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
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.