This document collects some odd bits and pieces on OData v4.
The OData specification says:
If a request for metadata does not specify a format preference (via Accept header or
$format
) then the XML representation MUST be returned.
Now, what if the client actually requests a format preference, and it does not include application/xml
? In theory, the server should return an error, stating the content is not acceptable (406). But the question is, how do actual OData clients in the wild do this? Do they request /$metadata
with the correct Accept
header, or would they break of the server actually behaved correctly?
Content negotiation using the Accept request header or the
$format
system query option is not allowed with the path segment/$count
.
So, if the client asks for the count of items, content negotiation is not allowed, the result must be text/plain
. For correct HTTP behavior the client must include text/plain
with the accepted formats, otherwise the server should return a 406 status. Now, the only specified formats for OData are a JSON and an XML representation, so I'd expect clients to request those… but do they also allow text/plain
in "real life"?