Courseiva
AI and Network OperationshardTroubleshootingObjective-mapped

CCNA AI and Network Operations Practice Question

Exhibit

R1#show running-config | section interface GigabitEthernet0/0
interface GigabitEthernet0/0
 ip address 192.0.2.1 255.255.255.0
 no shutdown
!

R1#show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0     192.0.2.1       YES manual up                    up

RESTCONF base URI: https://192.0.2.1/restconf

Example GET URI (correct):
  GET /restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet0/0
  Accept: application/yang-data+json

Example PATCH URI (correct):
  PATCH /restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=0/0
  Content-Type: application/yang-data+json
  Body: {"Cisco-IOS-XE-native:interface":{"GigabitEthernet":[{"name":"0/0","shutdown":true}]}}

You are connected to R1 (192.0.2.1/24). Use RESTCONF to query the operational state of GigabitEthernet0/0 using the ietf-interfaces YANG module. Then, send a PATCH request to disable the interface (set 'enabled' to false) using the Cisco-IOS-XE-native YANG module. Identify the error when a PATCH request is sent with the wrong Content-Type header (application/json instead of application/yang-data+json) and when the PATCH URI uses an incorrect YANG path (ietf-interfaces instead of Cisco-IOS-XE-native).

⚠ Common exam trap

The trap is that candidates may focus on the YANG module path error (ietf-interfaces vs Cisco-IOS-XE-native) and miss that the question explicitly asks about the error when the Content-Type header is wrong. Always read the question carefully to identify the specific condition being tested.

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 PATCH request fails with a 415 Unsupported Media Type error because the Content-Type header must be application/yang-data+json, not application/json.

The correct GET request uses the ietf-interfaces YANG module path to retrieve interface state. For the PATCH, the Cisco-IOS-XE-native module is used because it supports writing native configuration (including shutdown). Sending PATCH with Content-Type: application/json is rejected because RESTCONF requires application/yang-data+json. Using ietf-interfaces in the PATCH URI fails because that module is read-only for operational state; the server returns 404 or 405. The correct PATCH body sets 'shutdown' to true within the native interface container.

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 PATCH request fails with a 415 Unsupported Media Type error because the Content-Type header must be application/yang-data+json, not application/json.

    Why this is correct

    In RESTCONF (RFC 8040), the media type application/yang-data+json is the only valid JSON representation for YANG data in request bodies. Sending application/json violates the server's expected media type, causing an HTTP 415 Unsupported Media Type error before any body processing occurs. This is a media-type negotiation failure, not a payload error. Even if the JSON body is perfectly valid, the wrong Content-Type alone triggers rejection.

  • The PATCH request fails with a 404 Not Found error because the URI uses ietf-interfaces, which is a read-only module for operational state; the server cannot write to it.

    Why it's wrong here

    This is incorrect because while using ietf-interfaces in the PATCH URI would indeed cause an error (404 or 405), the question specifically asks about the error when the Content-Type header is wrong. The correct answer focuses on the Content-Type issue.

  • The PATCH request succeeds but the interface is not disabled because the body must use 'shutdown' instead of 'enabled'.

    Why it's wrong here

    This is incorrect because the question states that the PATCH request is sent with the wrong Content-Type header, which would cause a 415 error before the server even processes the body. The body content is irrelevant if the Content-Type is wrong.

  • The PATCH request fails with a 400 Bad Request error because the body must be XML, not JSON.

    Why it's wrong here

    This is incorrect because RESTCONF does not mandate XML; it supports both JSON and XML payloads. An XML body would require Content-Type: application/yang-data+xml, while JSON requires application/yang-data+json. A 400 Bad Request would indicate malformed syntax or invalid semantic constraints, not a preference for XML. Here the real cause is the unsupported Content-Type application/json, which yields a 415, not a 400.

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 PATCH request fails with a 415 Unsupported Media Type error because the Content-Type header must be application/yang-data+json, not application/json.Correct answer

Why this is correct

In RESTCONF (RFC 8040), the media type application/yang-data+json is the only valid JSON representation for YANG data in request bodies. Sending application/json violates the server's expected media type, causing an HTTP 415 Unsupported Media Type error before any body processing occurs. This is a media-type negotiation failure, not a payload error. Even if the JSON body is perfectly valid, the wrong Content-Type alone triggers rejection.

The PATCH request fails with a 404 Not Found error because the URI uses ietf-interfaces, which is a read-only module for operational state; the server cannot write to it.Wrong answer — click to see why

Why this is wrong here

The specific factual error is that the question asks about the error when the Content-Type header is wrong, not the URI path. The URI path error is a separate issue.

Why candidates choose this

Candidates might pick this because they know that ietf-interfaces is read-only and that using it in a PATCH would fail, but they overlook that the question is specifically about the Content-Type header error.

The PATCH request succeeds but the interface is not disabled because the body must use 'shutdown' instead of 'enabled'.Wrong answer — click to see why

Why this is wrong here

The specific factual error is that a wrong Content-Type header causes a rejection before any body parsing, so the request does not succeed.

Why candidates choose this

Candidates might think that the server might accept the request but ignore the 'enabled' field, not realizing that the Content-Type error prevents processing.

The PATCH request fails with a 400 Bad Request error because the body must be XML, not JSON.Wrong answer — click to see why

Why this is wrong here

The specific factual error is that RESTCONF does accept JSON; the issue is the exact media type string, not the format.

Why candidates choose this

Candidates might confuse RESTCONF with NETCONF, which uses XML, or think that JSON is not supported, but RESTCONF supports both.

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?”

About these practice questions

Courseiva writes every 200-301 question from scratch — 1,389 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 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.