JSON API 规范 - 服务器职责说明
JSON API Spec - Server Responsibilities Explanation
有人可以向我解释 JSON API 规范中提到的以下三点是什么吗?
Servers MUST send all JSON API data in response documents with the header Content-Type: application/vnd.api+json without any media type parameters.
我理解了第一部分,其中提到需求的响应将 Content-Type
header 设置为 application/vnd.api+json
,但我无法理解 without any media type parameters.
部分。
Servers MUST respond with a 415 Unsupported Media Type status code if a request specifies the header Content-Type: application/vnd.api+json with any media type parameters.
当它提到 media type parameters
时又迷路了。
Servers MUST respond with a 406 Not Acceptable status code if a request's Accept header contains the JSON API media type and all instances of that media type are modified with media type parameters.
嗯,媒体类型与 "Content-Type" 几乎相同,只是有一些额外的提及,例如:
Content-Type: text/html
Content-Type: text/html; charset=UTF-8
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
他们说不要用
以外的任何方式回应
Content-Type: application/vnd.api+json
他们说如果请求 Content-Type:
header 不是 application/vnd.api+json
,则响应
Status: 415 Unsupported Media Type
他们说如果请求 Accept:
header 不是 application/vnd.api+json
那么响应
Status: 406 Not Acceptable
注意:
它们也意味着没有变体,例如
Content-Type: application/vnd.api+json+gzip
不可接受
有人可以向我解释 JSON API 规范中提到的以下三点是什么吗?
Servers MUST send all JSON API data in response documents with the header Content-Type: application/vnd.api+json without any media type parameters.
我理解了第一部分,其中提到需求的响应将 Content-Type
header 设置为 application/vnd.api+json
,但我无法理解 without any media type parameters.
部分。
Servers MUST respond with a 415 Unsupported Media Type status code if a request specifies the header Content-Type: application/vnd.api+json with any media type parameters.
当它提到 media type parameters
时又迷路了。
Servers MUST respond with a 406 Not Acceptable status code if a request's Accept header contains the JSON API media type and all instances of that media type are modified with media type parameters.
嗯,媒体类型与 "Content-Type" 几乎相同,只是有一些额外的提及,例如:
Content-Type: text/html
Content-Type: text/html; charset=UTF-8
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
他们说不要用
以外的任何方式回应Content-Type: application/vnd.api+json
他们说如果请求
Content-Type:
header 不是application/vnd.api+json
,则响应Status: 415 Unsupported Media Type
他们说如果请求
Accept:
header 不是application/vnd.api+json
那么响应Status: 406 Not Acceptable
注意: 它们也意味着没有变体,例如
Content-Type: application/vnd.api+json+gzip
不可接受