3 ms·
You shouldn't ever request ids from a server, you should request id -- as a single item -- or a collection defined by the server and named (such as user/friends
by tomjen3 14y ago
You shouldn't ever request ids from a server, you should request id -- as a single item -- or a collection defined by the server and named (such as user/friends.json, not users?id=for,bar,baz,foobar).
Basically rest apis map exactly one resource to a url and should never use the hack that is ?.
- steveklabnik 14y agoThat is simply not true. Can you provide me with some sort of citation on this? Fielding doesn't talk about URL construction in his thesis, and, in fact, specifically mentions things like collections and multiple entities residing in one resource. Also, ? is not a 'hack', I don't know where you're getting that from either.
- wycats 14y agoI used URL Templates (RFC 6570 - http://tools.ietf.org/html/rfc6570 http://tools.ietf.org/html/rfc6570) so that the request to the server is not ad-hoc, but instead fully described by the resource body.