On 06/21/2010 02:37 PM, Jason L Connor wrote:
I've been playing around with making our API conform to the restful
practices in the 'rest-practices' branch. While hacking away, I've
noticed that we don't really have any particular convention for the
format of parameters (read: body) passed into action POST calls.
There are a number of conventions we can adopt:
1. no convention: let each controller figure out the parameters it
expects and the order it expects them in.
REST is free-flowing enough, lets not make it worse with no convention.
2. only one parameter: the body contains only a single parameter, which
can be a list or dictionary of multiple parameters.
still seems too untyped for me. Even looking at the controller's
3. key word arguments: the body always contains a dictionary, of
<parameter name>:<parameter value> pairs
clear, concise and obvious. What isn't to love?
The reason I bring this up is: The restful practices has produced some
very nice looking patterns that allow for some abstraction in the web
services layer. However, not having a convention for the way parameters
are passed into the action uris limits our ability of abstraction and
places a burden on both client and server developers by having to know
how to format parameters on a action by action basis.
I don't have really strong feelings about this. But it seems like a nice
practice for consistency.
I vote #3. keep it named and obvious.