Search code examples
ietf-restconf

Is there a default media type for GET and other methods


Is there any default media type when the query is not specified with any supported media types in RESTCONF ?


Solution

  • No. There is no standard default. This is server implementation dependent, so do not rely on it.

    From draft-ietf-netconf-restconf-17, Section 5.3, Message Encoding:

    The server MUST support the "Accept" header field and "406 Not Acceptable" status-line, as defined in [RFC7231]. The response output content encoding formats that the client will accept are identified with the Accept header field in the request. If it is not specified, the request input encoding format SHOULD be used, or the server MAY choose any supported content encoding format.

    If there was no request input, then the default output encoding is XML or JSON, depending on server preference. File extensions encoded in the request are not used to identify format encoding.

    And from draft-ietf-netconf-restconf-17, Section 7.1, Error Response Message:

    The client SHOULD specify the desired encoding(s) for response messages by specifying the appropriate media-type(s) in the Accept header. If the client did not specify an Accept header, then the same structured syntax name suffix used in the request message SHOULD be used, or the server MAY choose any supported message encoding format. If there is no request message the server MUST select "application/yang-data+xml" or "application/yang-data+json", depending on server preference.