{"action":"created","issue":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/404","labels_url":"https://api.github.com/repos/keystonejs/keystone/issues/404/labels{/name}","comments_url":"https://api.github.com/repos/keystonejs/keystone/issues/404/comments","events_url":"https://api.github.com/repos/keystonejs/keystone/issues/404/events","html_url":"https://github.com/keystonejs/keystone/pull/404","id":34949401,"number":404,"title":"Restish","user":{"login":"davidbanham","id":631832,"avatar_url":"https://avatars.githubusercontent.com/u/631832?v=3","gravatar_id":"","url":"https://api.github.com/users/davidbanham","html_url":"https://github.com/davidbanham","followers_url":"https://api.github.com/users/davidbanham/followers","following_url":"https://api.github.com/users/davidbanham/following{/other_user}","gists_url":"https://api.github.com/users/davidbanham/gists{/gist_id}","starred_url":"https://api.github.com/users/davidbanham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidbanham/subscriptions","organizations_url":"https://api.github.com/users/davidbanham/orgs","repos_url":"https://api.github.com/users/davidbanham/repos","events_url":"https://api.github.com/users/davidbanham/events{/privacy}","received_events_url":"https://api.github.com/users/davidbanham/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/keystonejs/keystone/labels/(status)%20needs%20review","name":"(status) needs review","color":"cb137f"},{"url":"https://api.github.com/repos/keystonejs/keystone/labels/enhancement","name":"enhancement","color":"2a7e44"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/keystonejs/keystone/milestones/4","html_url":"https://github.com/keystonejs/keystone/milestones/0.3.x","labels_url":"https://api.github.com/repos/keystonejs/keystone/milestones/4/labels","id":748849,"number":4,"title":"0.3.x","description":"Things that will be addressed after our move to React","creator":{"login":"JedWatson","id":872310,"avatar_url":"https://avatars.githubusercontent.com/u/872310?v=3","gravatar_id":"","url":"https://api.github.com/users/JedWatson","html_url":"https://github.com/JedWatson","followers_url":"https://api.github.com/users/JedWatson/followers","following_url":"https://api.github.com/users/JedWatson/following{/other_user}","gists_url":"https://api.github.com/users/JedWatson/gists{/gist_id}","starred_url":"https://api.github.com/users/JedWatson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JedWatson/subscriptions","organizations_url":"https://api.github.com/users/JedWatson/orgs","repos_url":"https://api.github.com/users/JedWatson/repos","events_url":"https://api.github.com/users/JedWatson/events{/privacy}","received_events_url":"https://api.github.com/users/JedWatson/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":18,"state":"open","created_at":"2014-08-10T16:10:22Z","updated_at":"2015-10-05T05:22:16Z","due_on":null,"closed_at":null},"comments":13,"created_at":"2014-06-04T11:10:39Z","updated_at":"2015-12-17T20:39:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/keystonejs/keystone/pulls/404","html_url":"https://github.com/keystonejs/keystone/pull/404","diff_url":"https://github.com/keystonejs/keystone/pull/404.diff","patch_url":"https://github.com/keystonejs/keystone/pull/404.patch"},"body":"I think this is now at the point where it warrants discussion. The point of this PR is to get an out-of-the-box generic list API from Keystone that works with [AngularJS' resource service](https://docs.angularjs.org/api/ngResource/service/$resource) and is generally rest-y.\r\n\r\nThe main things I've done are:\r\n\r\n  1. add a new getAll method to the generic list api\r\n  1. add a new endpoint at /keystone/restish_api\r\n\r\nThe new getAll method does what it says on the tin. Returns all members of a list. The obvious threat here is that maybe that list is gigantic. If so, I think the onus is on the app developer to add their own API routes. I think the happy path is to have it Just Work out of the box, and once you've got enough data for that to be a problem you can deal with it in whatever way makes sense for your app.\r\n\r\nIt would have been super-nice to be able to overload the /keystone/api endpoint so that it was compatible with angular, but I couldn't see a way to do it without also intercepting the old-style API calls to that endpoint. In order to not break backwards compatibility, I've namespaced these changes.\r\n\r\nI think it's worth asking the question about backwards compatibility with this API, though. To my mind, the closer we get to the common conception of RESTfulness, the better. Even if you're not using Angular, this should work with most things that expect a rails-style REST API. Anyone that's used that kind of API in the past should be able to get up to speed pretty quickly without needing to read the docs."},"comment":{"url":"https://api.github.com/repos/keystonejs/keystone/issues/comments/165576084","html_url":"https://github.com/keystonejs/keystone/pull/404#issuecomment-165576084","issue_url":"https://api.github.com/repos/keystonejs/keystone/issues/404","id":165576084,"user":{"login":"christroutner","id":9870991,"avatar_url":"https://avatars.githubusercontent.com/u/9870991?v=3","gravatar_id":"","url":"https://api.github.com/users/christroutner","html_url":"https://github.com/christroutner","followers_url":"https://api.github.com/users/christroutner/followers","following_url":"https://api.github.com/users/christroutner/following{/other_user}","gists_url":"https://api.github.com/users/christroutner/gists{/gist_id}","starred_url":"https://api.github.com/users/christroutner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christroutner/subscriptions","organizations_url":"https://api.github.com/users/christroutner/orgs","repos_url":"https://api.github.com/users/christroutner/repos","events_url":"https://api.github.com/users/christroutner/events{/privacy}","received_events_url":"https://api.github.com/users/christroutner/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T20:39:10Z","updated_at":"2015-12-17T20:39:10Z","body":"I got [a thread going on the mailing list](https://groups.google.com/forum/#!topic/keystonejs/juWVUxTJjeo) to continue discussion of this pull request. Ultimately, the effort to implement a standardized RESTful API is too much effort for my needs at the moment, so I have to abandon this. I sure hope someone else picks this up.\r\n\r\nFor reference though, here is the REST format that Backbone.js (and Angular.js and Ember.js too, I think) expects:\r\n\r\nThe default sync handler maps CRUD to REST like so:\r\n\r\ncreate → POST   /collection\r\nread → GET   /collection[/id]\r\nupdate → PUT   /collection/id\r\npatch → PATCH   /collection/id\r\ndelete → DELETE   /collection/id\r\n\r\nThis was taken from [the Backbone.js documentation](http://backbonejs.org/#Sync). "}}