Courseiva
Automation →mediumMultiple Choice

350-401 Automation Practice Question

A network engineer is writing a Python script to retrieve the operational state of a GigabitEthernet interface 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/interface=GigabitEthernet1 but receives a 406 Not Acceptable response. The device supports RESTCONF and the interface exists. Which HTTP header should the engineer add to the request to resolve this error?

⚠ Common exam trap

Watch out — candidates often confuse the Accept header, which specifies the desired response format, with the Content-Type header, which specifies the format of the request body, leading to an incorrect fix.

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

✓

Accept: application/yang-data+json

The 406 Not Acceptable status code indicates that the server cannot produce a response matching the Accept header. In RESTCONF, the client must specify the desired media type, such as application/yang-data+json, to retrieve data in JSON. Without it, the server may reject the request. Adding the correct Accept header resolves the negotiation issue.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Accept: application/xml

    Why it's wrong here

    While application/xml is a valid media type for RESTCONF, the error indicates the server cannot satisfy the requested Accept type. If the original request had no Accept header, the server might default to XML, but the 406 suggests a mismatch. Specifying XML could work only if the device supports XML, but JSON is the typical choice for Python scripts, and the question implies JSON is needed.

  • ✓

    Accept: application/yang-data+json

    Why this is correct

    RESTCONF requires the client to specify the desired media type for the response. The 406 Not Acceptable error occurs when the Accept header is missing or does not match a media type the server can produce. Adding Accept: application/yang-data+json tells the server to return the data in JSON format, which IOS XE supports, resolving the error.

  • ✗

    Authorization: Basic YWRtaW46YWRtaW4=

    Why it's wrong here

    The Authorization header is used for authentication. If authentication failed, the server would return 401 Unauthorized, not 406 Not Acceptable. Since the error is 406, the credentials are likely already accepted or the issue is not authentication. Adding Authorization would not fix the media type negotiation problem.

  • ✗

    Content-Type: application/yang-data+json

    Why it's wrong here

    The Content-Type header describes the media type of the request body. For a GET request, there is typically no body, so Content-Type is not required and does not affect the 406 error. The 406 is about the response format the client can accept, which is controlled by the Accept header, not Content-Type.

Visual reference

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

Go deeper

Related to this question

About these practice questions

One of 1,923 original 350-401 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.