I'm building a little tool to help people decide on group activities, like what restaurant they should go to for lunch. My objects are events, options and preferences. An event has several options, a user can rank the options on an invent in order. So a user's votes may be 1:option B, 2:option A, 3:option C.
My question is what is the best way to map this to REST? It seems clear that I should support CRUD on events, with
GET /events/ : list of events
POST /events/ : create a new event
GET /events/1 : get event one
and on options with:
POST /events/1/options : add a new option to the event
(in all cases, there must be an authenticated user)
Where I get confused is how does a user vote on the options for the event. What seems to fit REST best is to do a PUT for each option, to /events/1/options/1/vote, but this seems like it would be hard to enforce requirements between the votes, for example, if I wanted to force the votes to rank the options without ties, I could do this if I got all the votes at once, as in 1 B, 2 A, 3 C, but if the user changes his votes to 1 C, 2 B, 3 A, the app would be in an invalid state between those requests.
Should I make the votes a single package, and access them at /events/1/votes?
(This may seem an excessive amount of planning for a weekend project, but my purpose is to do it right, since I don't have that luxury on code I'm paid to write.)