I have a REST api that will accept a version via a custom HTTP header or a request parameter. I’m doing this because I don’t want the URI to contain the version like del.icio.us .e.g http://server/api/v1/…
Now in my design, the HTTP header has a higher priority than the request param.
What happens then if the user does not supply any version at all ?
Should I default to the oldest version, or default to the latest version ?
Don’t version the URI at all. Instead just version the representation. This way the client can decide which version of the API they want to use and it degrades well.
Example: