Courseiva
Automation →easyMultiple Choice

CCNP Automation Practice Question

A network engineer is using a Python script with the requests library to retrieve interface information from a Cisco IOS XE device via RESTCONF. The script sends a GET request to https://192.168.1.1/restconf/data/ietf-interfaces:interfaces but receives a 401 Unauthorized error. The engineer has verified that the device has RESTCONF enabled and the URL is correct. Which action should the engineer take to resolve the error?

⚠ Common exam trap

The trap here is thinking that enabling RESTCONF is sufficient for access, when in fact authentication credentials must also be supplied with each request.

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

✓

Include a valid username and password in the request using HTTP Basic Authentication.

A 401 Unauthorized error means the request lacks valid authentication credentials. RESTCONF on Cisco IOS XE requires HTTP Basic Authentication. The engineer must include a valid username and password in the request headers. This is the correct and secure way to authenticate RESTCONF requests.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Enable the RESTCONF-YANG feature on the device using the restconf-yang command in global configuration mode.

    Why it's wrong here

    The engineer has already verified that RESTCONF is enabled. The restconf-yang command is not a valid Cisco IOS XE command; the correct command is 'restconf'. Since RESTCONF is already enabled, this action is unnecessary. The 401 error is specifically about authentication, not feature enablement. Enabling the feature again would not resolve the authentication issue.

  • ✗

    Change the request method from GET to POST to retrieve the interface information.

    Why it's wrong here

    RESTCONF uses HTTP methods semantically: GET for retrieval, POST for creation, PUT/PATCH for updates, and DELETE for removal. Changing to POST would not fix authentication and would be incorrect for retrieving data. The 401 error is related to authentication, not the HTTP method. Using POST to retrieve data would likely result in a different error or unexpected behavior.

  • ✗

    Configure the device to allow unauthenticated access by adding the 'restconf no-auth' command.

    Why it's wrong here

    Cisco IOS XE does not support unauthenticated RESTCONF access; there is no 'restconf no-auth' command. All RESTCONF requests must be authenticated. Disabling authentication would be a severe security risk and is not an option. The correct solution is to provide valid credentials. This option is a distractor that suggests an insecure and non-existent configuration.

  • ✓

    Include a valid username and password in the request using HTTP Basic Authentication.

    Why this is correct

    A 401 Unauthorized error indicates that the request lacks valid authentication credentials. RESTCONF on Cisco IOS XE requires authentication, typically via HTTP Basic Authentication. The engineer must include the username and password in the request headers. This is the standard method to authenticate RESTCONF requests. Without credentials, the device rejects the request, resulting in a 401 error.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

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 →

How Courseiva writes practice questions · Editorial policy

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.