[Catalyst] Re: General API question: REST + SOAP
pagaltzis at gmx.de
Thu Apr 7 03:52:33 GMT 2011
* Dave Rolsky <autarch at urth.org> [2011-04-07 05:25]:
> On Thu, 7 Apr 2011, Aristotle Pagaltzis wrote:
> >This is a very bad idea. No matter what problem you have,
> >a custom HTTP header is very nearly certainly the wrong
> >solution. For API versioning it definitely is.
> My understanding of REST, at least, is that versioning should
> be done by specifying different Accept and Content-Type
> headers, like x-application/x-myapp-auction-item-v1.
> This makes sense with REST, since the URI for a thing should
> always stay the same, but it's representation can vary. The API
> version is part of that representation.
There isn’t any requirement in REST that a resource have only one
URI. There is much less so any requirement that a resource be the
equivalent of a platonic idea. In fact, if you try to treat them
that way, you cause yourself problems that REST is meant to
eliminate – it increases the coupling of client and server that
REST aims to loosen.
Switching media types is not a bad idea, much better than using
a header anyway. But you want to be very careful about just when
you make a change as disruptive as that, as well you don’t want
to use too application-specific media types, because doing so
very nearly eliminates the opportunity to bind services together
in unforeplanned ways (“serendipity”, in Roy’s words, “mash-ups”
if you are Web 2.0 hipster, “synergy” if you are the CTO, or just
plain “integration” if you’re the one getting work done :-) ).
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Catalyst