2.2.3.6.1.5 Format System Query Option ($format)

A data service URI with a $format system query option specifies that a response to the request SHOULD use the media type specified by the query option.

If the $format query option is present in a request URI, it SHOULD take precedence over the value(s) specified in the Accept (section 2.2.5.1) request header.

The syntax of the format system query option is defined as follows.

 formatQueryOp = "$format="
                 ("verbosejson"
                  / "json"
                  / "atom"
                  / "xml"
                  / <a data service specific value indicating a format specific
                     to the specific data service>
                  / <An IANA-defined [IANA-MMT] content type>
                 )
  • If the value of the query option is "atom", the media type used in the response MUST be "application/atom+xml".

  • If the value of the query option is "verbosejson", the media type used in the response MUST be "application/json;odata=verbose".

  • If the value of the query option is "json", the media type used in the response MUST be "application/json".

  • If the value of the query option is "xml", the media type used in the response MUST be "application/xml".

Examples:

http://host/service.svc/Orders?$format=verbosejson

The set of Order entities represented using the Verbose JSON media type, as specified in [RFC4627].

The $format query option MAY be used in conjunction with RAW format (section 2.2.6.4) to specify which RAW format is returned.

Example:

 http://host/service.svc/Orders(1)/ShipCountry/$value/?$format=verbosejson