What is the difference between the «application/json» and «application/vnd.api+json» content types of a Web API response?

web-api
(Dmitry Fedyuk) #1

application/json

[
	{
		"id": 7,
		"date": "2016-05-10",
		"price": 89,
		"support_till": null,
		"explanation": null,
		"currency": 1,
		"product": 1,
		"website": 7
	},
	<...>
]

application/vnd.api+json

{
	"data": [
		{
			"type": "extenddforders",
			"id": "7",
			"attributes": {
				"date": "2016-05-10",
				"price": 89,
				"support_till": null,
				"explanation": null
			},
			"relationships": {
				"currency": {
					"data": {
						"type": "extenddfcurrencies",
						"id": "1"
					}
				},
				"product": {
					"data": {
						"type": "extenddfproducts",
						"id": "1"
					}
				},
				"website": {
					"data": {
						"type": "extenddfwebsites",
						"id": "7"
					}
				}
			}
		},
		<...>
	]
}

application/vnd.api+json allows you to use the include statement, but application/json does not.

0 Likes

The Web API documentation