| « Resources are concepts for the client | CherryPy for Python 3000 » |
Interesting timing on Joe Gregorio's latest foray. Lately, I've been URI-ifying all the JSON calls which etsy.com's PHP layer makes to the back end (partly with the hope that that API would be opened up to the public someday, but that isn't currently a business need). Even though the company is bucking the mainstream quite successfully, the site itself is pretty typical e-commerce. Here's what I ended up with.
Out of 298 URI's (not counting querystring variants):
/users/{user_id}/images/)/collection/subcollection/{id}, and tend to map to a database row (although many of those are virtual, being split in practice over several tables)./collection/count./collection/ids/./collection/count_and_limited_ids, which is perhaps a quirk of our architecture; at some point, I'd like to see how splitting these each into 2 calls affects performance.DELETE /collection/{id}/cacheThe URI space for this API is pretty sparse right now--these URI were simply created to replace an existing RPC-style space of procedure names. And it's essentially a single data point. However, I think it's pretty representative of e-commerce needs for RESTful JSON. One lesson might be that pagination (count and ids) should be addressed in any coordinated protocol effort.
This is what I like about CouchDB, which I've started working with lately. REST JSon API is the only way to talk to the DB. Seems like a brilliant choice. How did you implement all of your API's? Did you use any particular framework or is it just hand built PHP?
It's Python, actually. We started with Twisted but had to abandon that once we did some load tests.