News for hackers. Stuff that matters.
Re:Teach a Dog to REST by ericingram on Sunday September 16, 2012 @03:54PM (#4530148)
Forward (http://getfwd.com) employs conventions like this between the template and model layers of an MVC style framework.

    get("/accounts") // collection
    get("/accounts", [limit => 10, page => 3]) // pagination
    get("/accounts/[email protected]") // single record
    get("/accounts/[email protected]/orders") // relations
    get("/accounts/[email protected]/orders/10234/items/6/price") // deep relations
    get("/accounts", [search => "john"]) // search
    get("/accounts", [fields => "name, email"]) // partials
    get("/accounts", [order => "name desc"]) // sorting
    get("/accounts", [login => [...]]) // special conventions
    post("/accounts", [alternate_email => $alt, ":validate" => [required => [alternate_email]]) // validation
    put(...) // pretty much what you expect
    delete(...) // same
The interesting thing about moving REST conventions to the model layer, is that you can suddenly create external facing APIs in various formats really easily. I'm hoping/expecting this will become a more common pattern.

There are no comments on this comment yet.