Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Naive approach to handling OData Endpoint versioning using an HTTP header

License

Notifications You must be signed in to change notification settings

jordansjones/ODataVersioning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ODataVersioning - Proof of Concept

Naive approach to handling OData Endpoint versioning using an HTTP header

In this example application using the x-api-version request header will determine which Product to use. For example:

GET /srv/Products HTTP/1.1
x-api-version: 1

Will return a collection of SimpleProduct entities that have the following properties:

{
  "Id": 1,
  "Name": "A Product Name",
  "Price": 1.0
}

while

GET /srv/Products HTTP/1.1
x-api-version: 3

and

GET /srv/Products HTTP/1.1

Will return a collection of CategorizedProduct entities that have the following properties:

{
  "Id": 1,
  "Name": "A Product Name",
  "Price": 1.0,
  "Category": "The worst category ever."
}

This implementation has the added benefit that if a x-api-version value is outside the range of supported versions, it will return a 406 Not Acceptable error. Additionally if the x-api-version request header is not present, the implementation will assume the current version is desired.

In this example, the valid version range is 1 through 5.

About

Naive approach to handling OData Endpoint versioning using an HTTP header

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published