350-401 Automation Practice Question
A network engineer is writing a Python script to retrieve the list of interfaces from a Cisco IOS XE device using RESTCONF. The script sends a GET request to https://10.1.1.1/restconf/data/ietf-interfaces:interfaces and receives a 401 Unauthorized response. The device is reachable, and RESTCONF is enabled. The engineer verifies that the username and password are correct. Which action should the engineer take to resolve the issue?
⚠ Common exam trap
The trap here is assuming that a 401 error means incorrect credentials, when it often means credentials were never sent.
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
✓
Configure the HTTP client to use basic authentication with the correct credentials.
A 401 Unauthorized response indicates that the request lacks valid authentication credentials. RESTCONF relies on HTTP authentication, so the client must include an Authorization header, typically using basic authentication. Even if the username and password are correct, they must be transmitted with the request. The other options address different issues: content negotiation, API enablement, or HTTP method, none of which cause a 401. Therefore, configuring basic authentication is the correct fix.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Configure the HTTP client to use basic authentication with the correct credentials.
Why this is correct
A 401 Unauthorized response means the request lacks valid authentication credentials. RESTCONF uses HTTP authentication, typically basic auth. The engineer must include an Authorization header with the base64-encoded username:password. Even if the credentials are correct, they must be sent in the request. The script likely omitted the auth parameter, causing the server to reject the request. Adding basic authentication resolves the issue.
- ✗
Enable the RESTCONF API using the 'restconf' command under global configuration.
Why it's wrong here
RESTCONF must be enabled, but the scenario states that RESTCONF is already enabled. If it were disabled, the server would likely return a 404 Not Found or connection refused, not a 401 Unauthorized. A 401 specifically points to an authentication failure. Therefore, re-enabling RESTCONF would not fix the problem and is unnecessary given the information provided.
- ✗
Change the request method from GET to POST.
Why it's wrong here
The HTTP method determines the operation: GET retrieves data, POST creates data. Changing to POST would not resolve a 401 Unauthorized error because authentication is still required. Moreover, POST to a data resource might create or modify configuration, which is not the goal. The issue is missing authentication, not the method. Using POST would likely result in a different error, such as 405 Method Not Allowed.
- ✗
Add the header 'Accept: application/yang-data+json' to the request.
Why it's wrong here
The Accept header tells the server what media type the client expects in the response. Without it, the server might return XML or a 406 Not Acceptable, but it would not cause a 401 Unauthorized. A 401 indicates an authentication problem, not a content negotiation issue. Adding this header is good practice for JSON responses but does not address the authentication failure described in the scenario.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every 350-401 question from scratch — 1,923 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 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.