zackyang000 / node-odata

A library for easily create OData REST API, abide by OData protocol.
http://zackyang000.github.io/node-odata/en/
MIT License
365 stars 65 forks source link

$format query option #99

Open r1mar opened 2 years ago

r1mar commented 2 years ago

Hello Zack,

a feature that is not implemented too.

http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#_Toc31358963 11.2.11 System Query Option $format The $format system query option specifies the media type of the response.

The $format query option, if present in a request, MUST take precedence over the value(s) specified in the Accept request header.

The value of the $format system query option is a valid internet media type, optionally including parameters.

In addition, format-specific abbreviations may be used, e.g. json for application/json, see [OData-JSON], but format parameters MUST NOT be appended to the format abbreviations.

Regards, Richard

Example 74: the request

GET http://host/service/Orders?$format=application/json;metadata=full

is equivalent to a request with an Accept header using the same media type; it requests the set of Order entities represented using the JSON media type including full metadata, as defined in [OData-JSON].

Example 75: the request

GET http://host/service/Orders?$format=json

is equivalent to a request with the Accept header set to application/json; it requests the set of Order entities represented using the JSON media type with minimal metadata, as defined in [OData-JSON].

In metadata document requests, the values application/xml and application/json, along with their subtypes and parameterized variants, as well as the format-specific abbreviations xml and json, are reserved for this specification.