Search code examples
odata

OData-Version header in odata v4


In odata v4, OData clients can include the OData-MaxVersion header in requests in order to specify the maximum acceptable response version. Does it mean a odata v2 client can still talk to odata v4 server by specifying "OData-MaxVersion : 2" header? Is it mandatory for an odata v4 provider to be able to support lower protocol version of client?


Solution

  • Yes, a V2 client can talk to a V4 server. The client should identify its protocol version using the OData-Version request header. If a V2 client wants a V2 response from a V4 service, then the client must include the OData-MaxVersion header in the request. For example:

    GET http://host/MyEntitySet
    
    OData-Version: 2.0
    OData-MaxVersion: 2.0
    

    But it is not mandatory for an OData v4 service to support a lower protocol version client. A conformant V4 service may respond to V1-V3 clients with 4XX-level errors.