RESTCONF JSON Requires application/yang-data+json Content-Type
Short answer
A RESTCONF JSON payloads require Content-Type: application/yang-data+json, not application/json, because the media type identifies YANG-modeled data under RFC 8040 and RFC 7951.
Question
Key Takeaways
RESTCONF JSON payloads use the YANG-specific media type application/yang-data+json, so the required request header is Content-Type: application/yang-data+json (Option A). Generic application/json describes JSON syntax but not the YANG data contract, so a strict RESTCONF server may reject a body sent with that media type.
Expert Analysis
Because a RESTCONF request body that carries JSON-encoded YANG data must declare the YANG-specific media type rather than generic JSON, the required header is Content-Type: application/yang-data+json, which makes A the answer.
application/yang-data+json versus application/json at the RESTCONF body boundary
The first pair differs in what the label promises about the bytes after the HTTP headers. application/json says only that the body is syntactically valid JSON; it says nothing about YANG modules, namespaces, container nesting, leaf types, identityrefs, or the rule that a top-level data node appears under a module-qualified object. application/yang-data+json is a structured media type registered for YANG-modeled data encoded in JSON, so it tells a RESTCONF server to parse the body as an instance document for a specific YANG model and to validate it against that model. A payload may be valid generic JSON and still fail as YANG data because it uses the wrong module namespace, omits a mandatory leaf, or represents an identityref as a bare string. The boundary is therefore semantic, not cosmetic: generic JSON is a syntax; YANG-data JSON is a syntax plus a data contract. In RESTCONF, the Content-Type header selects that contract for the request body, while a separate Accept header selects the representation the client wants back. Conflating the two is what makes application/json look close enough, even though it does not identify the model-defined structure the server must enforce.
The JSON payload in a RESTCONF POST or PUT is YANG instance data, not an arbitrary object
The decisive condition is the content of the request body: RESTCONF writes configuration or operations through a resource whose payload represents a YANG data tree. When that tree is serialized as JSON, RFC 8040 expects the application/yang-data+json media type, and the JSON encoding rules themselves come from the YANG-to-JSON mapping. That is why the header choice is not decided by the presence of curly braces or by the word JSON in a description; it is decided by whether the body is an instance of a YANG model. A plain application/json Content-Type tells the server only that it can parse JSON syntax, leaving it without the YANG media type it uses to dispatch the request to the correct parser and validator. If the operation is a GET with no body, Content-Type may be absent and Accept governs the response instead; the requirement is about transmitting JSON, so the body-bearing method is the relevant case. The presence of a modeled container such as interfaces or a native configuration subtree is the concrete signal that the YANG-specific type, not generic JSON, must be advertised.
B, C, and D each misdeclare the RESTCONF exchange in a different way
Option B keeps the Content-Type family correct but drops the YANG-specific suffix, so a strict RESTCONF server can answer 415 Unsupported Media Type or refuse to bind the body to the model; the request may look valid to a generic JSON parser and still fail before YANG validation. Option C supplies Accept: text/xml, which is a response preference for an XML representation and does nothing to declare a JSON request body; if the client sends JSON while advertising only XML, the server may return XML, return 406 Not Acceptable, or reject the undeclared body. Option D uses Content-Type: text/html, which labels the bytes as an HTML document, so the server has no reason to invoke a JSON or YANG parser and will normally reject the request as an unsupported media type. None of these options fixes the core mismatch: B under-specifies the JSON media type, C negotiates the wrong representation, and D declares a completely different document format. The cost is not merely a cosmetic header error; it is a failed content-negotiation step that prevents the RESTCONF operation from reaching configuration validation.
RFC 8040 media-type negotiation makes 415 and 406 the observable failure signals
RESTCONF inherits HTTP content negotiation, and the two headers have different jobs. Content-Type on the request describes the request body; Accept lists the response media types the client can handle. RFC 8040 requires application/yang-data+json for JSON-encoded YANG data, while RFC 7951 defines the JSON encoding and registers that media type. A server that does not support the request body's media type returns 415 Unsupported Media Type; a server that cannot produce any media type listed in Accept returns 406 Not Acceptable. Cisco IOS XE RESTCONF implementations follow this pattern, so a JSON POST with Content-Type: application/json is not treated as an acceptable alias for the YANG media type. The YANG media type is the only request media type that binds the body to a model, so a generic JSON label leaves the server without a validation context. The same media type also appears in Accept when the client wants a JSON response, but that is a separate field from the one needed to send JSON. Remembering the status codes turns the header rule into a diagnostic: 415 points at the request's Content-Type, while 406 points at Accept. That is why A is the required action for a JSON RESTCONF body, not merely the most descriptive-looking option.
Official Reference
These links open the official vendor documentation in a new tab.
Exam Strategy
For RESTCONF header questions, separate the request body from the response preference: a JSON body needs Content-Type: application/yang-data+json, while a JSON response request uses Accept with the same media type. Treat generic application/json, text/html, and an Accept that names XML as distractors, then diagnose by status code—415 points to Content-Type, 406 points to Accept. This pattern also applies to NETCONF/RESTCONF payload questions that test media types rather than URL paths.
Related Analysis
Practice All 300-435 Questions
Access 150 questions with complete answers and detailed explanations.
View Full 300-435 Practice Test →