mediumMultiple ChoiceObjective-mapped
350-401 RESTCONF Practice Question
A network engineer writes the following Python script using the Requests library to retrieve interface information from a Cisco IOS-XE device via RESTCONF:
```python
import requests import json
url = "https://10.1.1.1:443/restconf/data/ietf-interfaces:interfaces" headers = {
"Accept": "application/yang-data+json",
"Content-Type": "application/yang-data+json"
}auth = ("admin", "password") response = requests.get(url, headers=headers, auth=auth, verify=False)
print(response.json())
```
What is the primary issue with this code?
⚠ Common exam trap
Always double-check HTTP header spellings. A simple typo like 'Contet-Type' instead of 'Content-Type' will break RESTCONF requests.
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
✓
The 'Content-Type' header is misspelled as 'Contet-Type', which will cause the server to reject the request.
The primary issue is a typo in the 'Content-Type' header: it is written as 'Contet-Type'. RESTCONF requires the correct header to indicate the YANG data format. This misspelling will cause the server to reject the request with a 400 Bad Request error because it does not recognize the media type. The code is otherwise correct for RESTCONF access.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The URL uses HTTPS but the device only supports HTTP, causing a connection error.
Why it's wrong here
RESTCONF typically uses HTTPS. This is not the issue.
- ✓
The 'Content-Type' header is misspelled as 'Contet-Type', which will cause the server to reject the request.
Why this is correct
The header 'Contet-Type' is incorrect; it should be 'Content-Type'. This will cause the server to not recognize the media type.
- ✗
The 'verify=False' parameter is not valid for the requests library; it should be 'ssl_verify=False'.
Why it's wrong here
'verify' is a valid parameter in requests to disable SSL verification.
- ✗
The 'auth' tuple should be passed as a dictionary with 'username' and 'password' keys.
Why it's wrong here
Requests accepts a tuple for basic auth.
Go deeper
Related to this question
Learn chapter
Network Architecture Fundamentals
Key term
REST API for Network Devices
A REST API for network devices is a set of rules that allows software applications to communicate with routers, switches, and firewalls using standard web methods like GET, POST, PUT, and DELETE over HTTP or HTTPS.
Key term
JSON and XML in Networking
JSON and XML are two common data formats used in network automation and programmability to exchange structured information between network devices and management systems.
About these practice questions
This 350-401 question is part of Courseiva's 1,175-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 350-401 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 350-401 exam.