Courseiva
AI and Network OperationshardConfigurationObjective-mapped

CCNA AI and Network Operations Practice Question

Network Topology
G0/0203.0.113.1/24InternetR1RESTCONF client

You are connected to R1. Use RESTCONF to retrieve all operational interface statistics from the ietf-interfaces YANG module, then modify the description of GigabitEthernet0/1 to 'Link to R2 via RESTCONF' using a PATCH request. The device is reachable at 203.0.113.1 with port 443, username 'admin', password 'cisco123'. Identify the error that would occur if you used a PATCH with Content-Type: application/json instead of application/yang-data+json.

⚠ Common exam trap

The exam tests your knowledge of RESTCONF's strict media type requirements. Many candidates assume that application/json is acceptable because it is common in REST APIs, but RESTCONF specifically requires 'application/yang-data+json'. Remember that using any other media type results in a 415 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 415 Unsupported Media Type error because RESTCONF requires the Content-Type header to be application/yang-data+json.

The correct base URI for RESTCONF is https://203.0.113.1/restconf. To retrieve operational interface statistics, use GET with the path /data/ietf-interfaces:interfaces-state/interface. For the PATCH to modify the description, the URI must target /data/ietf-interfaces:interfaces/interface=GigabitEthernet0/1 with a JSON payload containing the 'description' leaf. The required Content-Type and Accept headers must be 'application/yang-data+json'. Using 'application/json' will result in a 415 Unsupported Media Type error because RESTCONF requires the specific YANG media type.

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 415 Unsupported Media Type error because RESTCONF requires the Content-Type header to be application/yang-data+json.

    Why this is correct

    RESTCONF (RFC 8040) requires that both request and response bodies use the YANG media type `application/yang-data+json`. When the client sends `Content-Type: application/json`, the server recognizes that the payload is not in the supported representation and responds with HTTP 415 Unsupported Media Type, indicating the media type is not acceptable. The JSON body itself is well-formed; the failure lies solely in the header negotiation.

  • The server returns a 400 Bad Request error because the JSON payload is malformed when using application/json.

    Why it's wrong here

    A 400 Bad Request error indicates that the HTTP server could not parse the request, typically because of malformed JSON syntax, invalid encoding, or a broken request line. In this scenario, the JSON payload is syntactically valid; the problem is that the `Content-Type` header does not match the required `application/yang-data+json`. Therefore, the server rejects the request with 415, not 400, because the media type is unsupported even though the payload is parseable.

  • The server returns a 404 Not Found error because the URI is incorrect when using application/json.

    Why it's wrong here

    A 404 Not Found response means the URI does not identify an existing resource on the RESTCONF server. Changing the `Content-Type` header to `application/json` does not alter the request URI or affect the resource lookup; the resource path remains valid and findable. The server evaluates the media type separately from the URI, so the correct error is 415 (unsupported media type), not 404.

  • The server returns a 204 No Content response but ignores the description change because application/json is not supported.

    Why it's wrong here

    A 204 No Content response is a success status sent after the server has performed the requested modification, such as a successful PATCH or PUT. Because RESTCONF requires the `Content-Type` to be `application/yang-data+json`, a request with `application/json` is rejected before any data model operation is applied. The server will not silently ignore the description change; it returns 415 Unsupported Media Type instead of processing the request.

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 415 Unsupported Media Type error because RESTCONF requires the Content-Type header to be application/yang-data+json.Correct answer

Why this is correct

RESTCONF (RFC 8040) requires that both request and response bodies use the YANG media type `application/yang-data+json`. When the client sends `Content-Type: application/json`, the server recognizes that the payload is not in the supported representation and responds with HTTP 415 Unsupported Media Type, indicating the media type is not acceptable. The JSON body itself is well-formed; the failure lies solely in the header negotiation.

The server returns a 400 Bad Request error because the JSON payload is malformed when using application/json.Wrong answer — click to see why

Why this is wrong here

The specific factual error is that a 400 Bad Request is not triggered by an incorrect Content-Type; it is triggered by malformed syntax or invalid data.

Why candidates choose this

Candidates might think that using a different media type would cause a parsing error, leading to a 400 response.

The server returns a 404 Not Found error because the URI is incorrect when using application/json.Wrong answer — click to see why

Why this is wrong here

The specific factual error is that the Content-Type header does not affect resource discovery; it only affects how the server interprets the payload.

Why candidates choose this

Candidates might confuse the error code for a missing resource with a media type error, especially if they have seen 404 errors in other contexts.

The server returns a 204 No Content response but ignores the description change because application/json is not supported.Wrong answer — click to see why

Why this is wrong here

The specific factual error is that an unsupported media type results in a client error (4xx), not a success response (2xx).

Why candidates choose this

Candidates might think the server silently ignores the unsupported media type and returns a success code, which is a common misconception about REST APIs.

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.