Courseiva
Automation →mediumMultiple Choice

350-401 Automation Practice Question

A network engineer is writing a Python script to retrieve the configured hostname from a Cisco IOS XE device using RESTCONF. The device has RESTCONF enabled, and the engineer sends a GET request to https://10.1.1.1/restconf/data/Cisco-IOS-XE-native:native/hostname with the header 'Accept: application/yang-data+json'. However, the request fails with HTTP 401 Unauthorized. The engineer verifies that the device is reachable and RESTCONF is enabled. What is the most likely reason for the failure?

⚠ Common exam trap

The trap here is assuming that a self-signed certificate or missing Content-Type header causes a 401 error, when in fact 401 is strictly about missing or invalid authentication credentials.

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 engineer did not include valid authentication credentials in the request, such as a username and password or a token.

The 401 Unauthorized status code is a clear indication that authentication failed. RESTCONF on Cisco IOS XE requires the client to provide credentials, usually via HTTP Basic Authentication. Without a valid Authorization header, the device denies access. The other options describe issues that would produce different error codes or are irrelevant to authentication.

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 RESTCONF URI is incorrect; it should be /restconf/data/ietf-interfaces:interfaces to retrieve hostname information.

    Why it's wrong here

    The URI /restconf/data/Cisco-IOS-XE-native:native/hostname is correct for retrieving the hostname using the Cisco IOS XE native YANG model. The ietf-interfaces model is for interface configuration, not hostname. An incorrect URI would result in a 404 Not Found or 400 Bad Request, not a 401 Unauthorized error.

  • ✗

    The RESTCONF API requires the use of HTTPS with a valid certificate, and the device's certificate is self-signed.

    Why it's wrong here

    A self-signed certificate causes certificate validation errors, not HTTP 401 Unauthorized. RESTCONF can be configured to use HTTP, but HTTPS is recommended. The 401 status indicates an authentication issue, not a certificate trust problem. The engineer would see SSL errors if the certificate were the cause.

  • ✓

    The engineer did not include valid authentication credentials in the request, such as a username and password or a token.

    Why this is correct

    HTTP 401 Unauthorized specifically indicates that the request lacks valid authentication credentials. RESTCONF on Cisco IOS XE requires authentication, typically via HTTP Basic Authentication or token-based methods. Without proper credentials, the device rejects the request. The engineer must include an Authorization header with valid credentials to succeed.

  • ✗

    The request is missing the 'Content-Type' header, which is required for all RESTCONF requests.

    Why it's wrong here

    The Content-Type header is used to describe the media type of the request body, which is not present in a GET request. For GET requests, only the Accept header is relevant to specify the desired response format. Missing Content-Type would not cause a 401 Unauthorized error; it might cause a 415 Unsupported Media Type if a body were present.

Go deeper

Related to this question

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 →

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.