[Catalyst] API Versioning for Web Services

Matt S Trout dbix-class at trout.me.uk
Mon Jul 28 21:43:09 BST 2008


On Sun, Jul 27, 2008 at 09:09:46AM -0700, Bill Moseley wrote:
> On Sat, Jul 26, 2008 at 06:00:39AM +0100, Matt S Trout wrote:
> > 
> > sub widget :Local VersionedXMLRPC('widget.get') {
> > 
> > sub widget_xmlrpc_v1 {
> > 
> > have VersionedXMLRPC apply a custom a ction class that does ->can
> > based dispatch, same way Catalyst::Action::REST does.
> 
> C::Action::REST uses "ActionClass('REST')" to specify the class for
> the action.  And with a custom request class, has a custom dispatcher to
> dispatch based on the request method.
> 
> Your example above does not use ActionClass.  Were you suggesting that
> these XMLRPC actions have their own action class, and if so how would
> the actions be setup then?

My example suggests you write _parse_VersionedXMLRPC_attr to apply
the action class etc.
 
> By the way, my assumption is I would have the entire XMLRPC API
> versioned.  I asked about this on the XMLRPC list and it was
> recommended that instead I version individual methods.  That is, have
> separate method names that include a version:
> 
>     widget.1.get
>     widget.2.get
>     etc.
> 
> which would make the Catalyst part very simple, but I'm not sure I
> like that idea of each method having a version in the method name.

I'd suggest a header, really. X-MyApp-XMLRPC-Api-Version: or similar.

Makes the versioning stuff optional, thus simplifying the simple case.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list