350-401 Automation Practice Question
A network engineer is writing a Python script using the requests library to interact with a Cisco IOS XE device's RESTCONF API. The script needs to authenticate using basic authentication and retrieve interface details. The engineer writes the following code snippet:
import requests
url = 'https://192.168.1.1/restconf/data/ietf-interfaces:interfaces' headers = {'Accept': 'application/yang-data+json'} response = requests.get(url, headers=headers, auth=('admin', 'password'), verify=False)
However, the script returns a 401 Unauthorized error. What is the most likely cause?
⚠ Common exam trap
The trap here is focusing on headers or URL formatting when a 401 error specifically indicates an authentication problem, not a content or syntax issue.
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 credentials are incorrect or the user does not have sufficient privileges.
A 401 Unauthorized response from RESTCONF means the authentication credentials are missing or invalid. The script uses basic authentication with a username and password; if those are incorrect or the user lacks permissions, the server rejects the request. The engineer should confirm the credentials and user privilege level.
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 credentials are incorrect or the user does not have sufficient privileges.
Why this is correct
A 401 Unauthorized error indicates authentication failure. The most likely cause is that the username or password is wrong, or the user account lacks the necessary permissions to access the RESTCONF API. The engineer should verify the credentials and ensure the user has appropriate privilege level (e.g., privilege 15).
- ✗
The verify=False parameter disables SSL verification, which causes the server to reject the request.
Why it's wrong here
Setting verify=False disables SSL certificate verification on the client side, but it does not affect server-side authentication. The server would still process the request and return 401 if credentials are bad. SSL verification issues typically result in SSL errors, not HTTP 401.
- ✗
The Accept header is set incorrectly; it should be application/yang-data+xml.
Why it's wrong here
The Accept header specifies the desired response format. Using application/yang-data+json is valid and would not cause a 401 error. A 401 is related to authentication, not content negotiation. If the header were invalid, the server might return a 406 Not Acceptable, not 401.
- ✗
The URL is missing the .json extension, which is required for RESTCONF.
Why it's wrong here
RESTCONF URLs do not require file extensions like .json. The media type is specified via headers. A missing extension would not cause a 401 error; it might result in a 404 if the path is wrong. The 401 clearly points to an authentication issue.
Go deeper
Related to this question
Learn chapter
SDN Controllers and Cisco ACI
Key term
NETCONF Protocol
NETCONF is a network management protocol that uses a structured data format to configure, retrieve, and modify network devices in a standard, programmatic way.
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.
About these practice questions
This 350-401 question is part of Courseiva's 1,923-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 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 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.