Hi Jason,

This is one of this things that could be solved ten different ways.
For example, you could add a path parameter so that the version is
recorded in the URI (http://example.com/version1/myresource).  You
could do it in a query param
(http://example.com/myresource?version=1).  You could do it in a
matrix param, or a header param.

For params:  http://incubator.apache.org/wink/1.0/html/JAX-RS%20Parameters.html

I think the major consideration is the decision of whether the end
user needs to know what version they're targetting or not.  If your
end user is a web browser, and the end user needs to know whether they
are using version 1 vs. version 2, then probably the path param, query
param, or matrix param is the best choice.  If the end user is a
client program where the versioning is transparent to the end user,
then perhaps the header param is the best choice for managing it.  In
the latter case, the decision of which version to use is being done at
the application level, rather than the user level.  You could more
easily switch which version is the default in your resource if the
decision is based on a header param that is not recorded in the URL,
but rather in a header; client apps would need no adjustment, and you
would not have to inform your humen end-users of the new version.

That's probably the criteria I would personally use; if the end-user
needs to see the version, then use path, query, or matrix params.  If
the end user does *not* need to see the version or the end user is a
client application that can automatically target the version it
requires, I'd probably use the header param.

It's a good question, and one that, as with many REST practices, ends
up having an answer of "whatever is appropriate for your particular
needs".  :)

For header params:
http://incubator.apache.org/wink/1.0/html/JAX-RS%20HTTP%20Headers.html

mike


On Sat, Apr 24, 2010 at 8:18 PM, Jason Dillon <[email protected]> wrote:
> Just curious if there is any recommended way to handle versioning of an apps 
> REST... either from jaxrs or from winkers.
>
> --jason

Reply via email to