CCNA AI and Network Operations Practice Question
Network Topology
You are connected to R1 (192.0.2.1/24, management IP). The network team needs to automate interface configuration using RESTCONF. Construct a valid RESTCONF GET request to retrieve the operational status of GigabitEthernet0/1 using the ietf-interfaces YANG module, and a PATCH request to set the description of that interface to 'Link to R2' using the Cisco-IOS-XE-native YANG module. Identify the error that occurs if the Accept header is set to application/json instead of application/yang-data+json.
⚠ Common exam trap
The exam tests your knowledge of RESTCONF media types and URL encoding: remember to percent-encode the slash in interface names (e.g., GigabitEthernet0%2F1) and distinguish between 406 (Accept error) and 415 (Content-Type error).
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 server returns a 406 Not Acceptable error because RESTCONF requires the Accept header to be 'application/yang-data+json'.
The correct base URI for RESTCONF on Cisco IOS-XE is https://<device-ip>/restconf/data. For the ietf-interfaces module, the YANG path is /ietf-interfaces:interfaces/interface=GigabitEthernet0%2F1 (note the percent-encoded slash in the key). For the Cisco-IOS-XE-native module, the path is /Cisco-IOS-XE-native:native/interface/GigabitEthernet=0%2F1/description. The Accept header must be 'application/yang-data+json'; using 'application/json' returns a 406 Not Acceptable error. The PATCH request body must contain the new description in JSON format. Failing to percent-encode the interface name will result in an invalid URI.
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 server returns a 406 Not Acceptable error because RESTCONF requires the Accept header to be 'application/yang-data+json'.
Why this is correct
RESTCONF (RFC 8040) mandates the media type application/yang-data+json for JSON-encoded YANG-defined data. When a client sets the Accept header to a generic value like application/json, the server cannot supply a representation that matches the client's stated preference for a YANG data resource. Per HTTP, the server then returns a 406 Not Acceptable error, signaling that no acceptable representation is available, and it will not downgrade to a different media type.
- ✗
The server returns a 400 Bad Request error because the Accept header must be 'application/json' for RESTCONF.
Why it's wrong here
A 400 Bad Request error indicates a malformed HTTP request, such as a syntax error in the request line, headers, or body; it is not a content negotiation response. Furthermore, the premise that RESTCONF requires Accept to be application/json is false—RESTCONF requires application/yang-data+json for JSON, so that claim is doubly incorrect. The Accept header is used for negotiation, and an unsupported value leads to 406, not 400.
- ✗
The server returns a 415 Unsupported Media Type error because the Accept header is set incorrectly.
Why it's wrong here
A 415 Unsupported Media Type error is triggered by an unacceptable Content-Type header (the format of the request body), not by the Accept header. Since the issue here is content negotiation for the response representation, and the request body is irrelevant or well-formed, 415 does not apply. HTTP semantics clearly separate request payload media types from response acceptable media types.
- ✗
The server returns a 200 OK response but ignores the Accept header and returns data in XML format.
Why it's wrong here
RESTCONF servers must honor HTTP content negotiation rules and RFC 8040 specifications; they do not silently ignore an unacceptable Accept header and fall back to another format. Returning XML would require the Accept header to explicitly include application/yang-data+xml, otherwise the server cannot select that representation. A 200 OK response with XML despite an invalid Accept header would violate both HTTP and RESTCONF, so the server correctly issues an error instead.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The 200-301 exam frequently reuses these exact scenarios with slightly different constraints.
✓The server returns a 406 Not Acceptable error because RESTCONF requires the Accept header to be 'application/yang-data+json'.Correct answer▾
Why this is correct
RESTCONF (RFC 8040) mandates the media type application/yang-data+json for JSON-encoded YANG-defined data. When a client sets the Accept header to a generic value like application/json, the server cannot supply a representation that matches the client's stated preference for a YANG data resource. Per HTTP, the server then returns a 406 Not Acceptable error, signaling that no acceptable representation is available, and it will not downgrade to a different media type.
✗The server returns a 400 Bad Request error because the Accept header must be 'application/json' for RESTCONF.Wrong answer — click to see why▾
Why this is wrong here
The specific factual error: RESTCONF requires 'application/yang-data+json', not 'application/json'.
Why candidates choose this
Candidates might think 'application/json' is acceptable because JSON is commonly used, but RESTCONF mandates a specific media type.
✗The server returns a 415 Unsupported Media Type error because the Accept header is set incorrectly.Wrong answer — click to see why▾
Why this is wrong here
The specific factual error: 415 relates to Content-Type, not Accept. Accept errors yield 406.
Why candidates choose this
Candidates may confuse Accept and Content-Type headers, thinking both cause 415 errors.
✗The server returns a 200 OK response but ignores the Accept header and returns data in XML format.Wrong answer — click to see why▾
Why this is wrong here
The specific factual error: RESTCONF does not silently fall back; it returns a 406 error.
Why candidates choose this
Candidates might assume the server is lenient and will respond with a default format, but RESTCONF is strict about media types.
Analysis generated from the official 200-301blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Go deeper
Related to this question
Learn chapter
Agentic AI in Network Operations
Key term
YANG
YANG is a data modeling language used to define the structure and constraints of data exchanged between network devices and management applications.
Key term
Interface
An interface is a point of connection or interaction between two systems, devices, or software components that allows them to exchange information or signals.
About these practice questions
This 200-301 question is part of Courseiva's 1,389-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 by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-301 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 200-301 exam.