200-901 · Question #281
Refer to the exhibit. A network engineer wants to use an API to update information about device interfaces. The network devices are deployed in a Cisco DevNet Sandbox and have running interfaces…
The correct answer is A. {'Content-Type': 'application/yang.data+xml', 'Accept': 'application/yang.data +xml'}. RESTCONF requires the media type application/yang.data+xml for XML-encoded YANG data, which must be specified in both the Content-Type and Accept headers.
Question
Refer to the exhibit. A network engineer wants to use an API to update information about device interfaces. The network devices are deployed in a Cisco DevNet Sandbox and have running interfaces. Which line of code needs to be placed in the snippet where the code is missing?
Exhibit
Options
- A{'Content-Type': 'application/yang.data+xml', 'Accept': 'application/yang.data +xml'}
- B{'Content-Type': 'application/yang.data+yaml', 'Accept': 'application/yang.data +yaml'}
- C{'Content-Type': 'application/restconf.data+json', 'Accept': 'application/ restconf.data+json'}
- D{'Content-Type': 'application/yang.data+utf8', 'Accept': 'application/ restconf.data+utf8'}
How the community answered
(40 responses)- A88% (35)
- B3% (1)
- C3% (1)
- D8% (3)
Why each option
RESTCONF requires the media type application/yang.data+xml for XML-encoded YANG data, which must be specified in both the Content-Type and Accept headers.
RFC 8040 defines the official RESTCONF media types for YANG-modeled data. When exchanging XML payloads, both the Content-Type header (declaring the format of the request body) and the Accept header (declaring the expected response format) must be set to application/yang.data+xml. This allows the RESTCONF server to correctly parse the incoming request and serialize the response.
YAML is not a recognized media type in the RESTCONF specification (RFC 8040); only JSON and XML encodings are defined for YANG data.
The correct MIME type prefix is application/yang.data, not application/restconf.data; the latter is not a valid RESTCONF media type.
application/yang.data+utf8 is not a defined RESTCONF media type; UTF-8 describes a character encoding, not a data serialization format.
Concept tested: RESTCONF YANG data media types for API headers
Source: https://www.rfc-editor.org/rfc/rfc8040#section-7.1
Topics
Community Discussion
No community discussion yet for this question.
