[Soved]: What is the most appropriate MIME type to use when sending data structured with YAML over HTTP?



Problem Statement:

An explanation of why a given choice is most appropriate would be much appreciated.

There is no registered application type or text type that I can see.

Example:

> GET /example.yaml< Content-Type: ????<< --- # Favorite movies< - Casablanca< - North by Northwest< - Notorious

Possible options:

text/yamltext/x-yamlapplication/yamlapplication/x-yaml

SolutionsTill now no MIME type for YAML is registered in YANA. It is totally up to you which will you use. use that one which both client and server can understand.

like Ruby on Rails uses application/x-yaml with an alternative of text/yaml.


On 7 Jul 2015 developers of YAML has proposed MIME type to YANA but they have not accepted that till now.

Proposed MIME type was

text/vnd.yaml

“x-” media types are discouraged, see RFC 4288, Section 3.4. The right thing to do is to use the personal tree, the vendor tree, or to actually attempt a proper media type registration.

So you can use application/vnd.yaml or text/vnd.yaml (text seems better)


References:

  1. https://www.ietf.org/mail-archive/web/media-types/current/msg00688.html
  2. https://tools.ietf.org/html/rfc4288#section-3.4
  3. https://stackoverflow.com/questions/332129/yaml-mime-type
  4. https://github.com/rails/rails/blob/13dd38cee79be39f7b399e142fd78295dddd2abb/actionpack/lib/action_dispatch/http/mime_types.rb#L23\