YAML mime type?
What is the most appropriate MIME type to use when sending data structured with YAML over HTTP?
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/yaml
text/x-yaml
application/yaml
application/x-yaml
Ruby on Rails uses application/x-yaml with an alternative of text/yaml (source).
I think it's just a matter of convention, there is no technical why, afaict.
I'd say text/x-yaml:
text over application because it's a human-readable
x-yaml over yaml because it hasn't been accepted into the registered list of mime types.
Edit: from RFC 3023 (XML Media Types):
The top-level media type "text" has some restrictions on MIME entities and they are described in [RFC2045] and [RFC2046]. In particular, the UTF-16 family, UCS-4, and UTF-32 are not allowed (except over HTTP[RFC2616], which uses a MIME-like mechanism).
Interesting... Not exactly sure what it means, but food for thought.
虽然另一个答案被接受,请参阅YAML线程这个提议的媒体类型登记的IANA邮件列表上审查媒体类型在本哈里斯,剑桥信息服务,代表YAML队的媒体类型的2015年7月提出的大学: text/vnd.yaml
带有(建议的)不推荐使用的别名: text/yaml text/x-yaml application/x-yaml
仍然提出/正在处理(线程未指示提案的状态),因此此答案不再具有权威性比其他人:-)
上一篇: RESTful服务中部分更新的最佳做法
下一篇: YAML MIME类型?