[Catalyst] RFC: Catalyst::Controller::REST::DBIC

Steve Atkins steve at blighty.com
Sun May 4 17:33:50 BST 2008

On May 4, 2008, at 9:02 AM, Christopher Laco wrote:

> My pet peeve is that /foo/primary_key makes computers happy... but  
> not people.
> /products/23
> /products/ABC-1234
> The first is the PK for a product record..
> The second is the actual sku for a product... just a unique as the  
> pk...but not the PK itself...
> Now what does "id" mean in this case?
> What id your SKU is a numeric just like your PK?
> Two different and equally useful ways to get at the same resource.
> If you're talking about an interface where humans know the skus, and  
> computers know the id (restfully and/or remotely).. you need a sane  
> uri:
> /products/id/<id>
> /products/sku/<sku>
> In the end, I always run into a situation where humans (think  
> marketing SEO pushers who know not of REST) want something other  
> than a true restful uri.

Part of the problem here might be the wish to avoid a natural
primary key in the database schema, preferring a synthetic
primary key even when there's a perfectly good natural
primary key.

That's something that I expect to see from the ruby on
rails crowd, not the (presumably more pragmatic) perl folks.

If your SKU is unique, then it's a perfectly good primary
key, and having a synthetic numeric primary key isn't
necessary. (It might be the right choice in some cases,
and not in others, but "the primary key is an arbitrary
integer" is not a given).


More information about the Catalyst mailing list