nerdexam
Cisco

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.

Understanding and Using APIs

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

200-901 question #281 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)
  • A
    88% (35)
  • B
    3% (1)
  • C
    3% (1)
  • D
    8% (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.

A{'Content-Type': 'application/yang.data+xml', 'Accept': 'application/yang.data +xml'}Correct

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.

B{'Content-Type': 'application/yang.data+yaml', 'Accept': 'application/yang.data +yaml'}

YAML is not a recognized media type in the RESTCONF specification (RFC 8040); only JSON and XML encodings are defined for YANG data.

C{'Content-Type': 'application/restconf.data+json', 'Accept': 'application/ restconf.data+json'}

The correct MIME type prefix is application/yang.data, not application/restconf.data; the latter is not a valid RESTCONF media type.

D{'Content-Type': 'application/yang.data+utf8', 'Accept': 'application/ restconf.data+utf8'}

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

#API Headers#RESTCONF#YANG Data#XML Serialization

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice