300-435 · Question #44
Refer to the exhibit. An engineer creates a Python script using RESTCONF to display hostname information. The code must be completed so that it can be tested. Which string completes the highlighted…
The correct answer is A. yang-data+json. When using RESTCONF to exchange YANG-modeled data encoded in JSON, the Content-Type header must be set to application/yang-data+json to correctly specify the data format.
Question
Options
- Ayang-data+json
- Byang+json
- Cyang.data+json
- Djson
How the community answered
(59 responses)- A92% (54)
- B5% (3)
- C2% (1)
- D2% (1)
Why each option
When using RESTCONF to exchange YANG-modeled data encoded in JSON, the `Content-Type` header must be set to `application/yang-data+json` to correctly specify the data format.
RESTCONF mandates the use of `application/yang-data+json` in the `Content-Type` and `Accept` headers when exchanging YANG-modeled data that is encoded in JSON. This specific content type clearly indicates that the payload adheres to the YANG data structure within a JSON format.
`yang+json` is an incorrect or non-standard media type for RESTCONF; the correct media type for YANG-modeled data in JSON is `yang-data+json`.
`yang.data+json` uses a period instead of a hyphen, making it an incorrect media type and therefore not recognized by RESTCONF.
`json` is too generic as a media type. While the data is indeed JSON, RESTCONF requires the more specific `yang-data+json` to explicitly identify the payload as YANG-modeled data.
Concept tested: RESTCONF Content-Type for YANG data
Source: https://www.rfc-editor.org/rfc/rfc8040#section-12.2
Topics
Community Discussion
No community discussion yet for this question.