An example for action is OPTIONS /dogs/:id/feed, this will result in dog status changing flowing the logic defined in server scripts.
Why don't you use POST
in this case? Actions are just a model for something you create/update, so you can use POST
(or PUT
in the case you know where to put the resource).
In this case, I would do the something like:
POST /dogs/:id/bowls
Content-Type: application/json
{
"bowlContent" : <food description>
}
This will create a bowl with the food inside (the meaning of feed in fact).
OPTIONS
is often used to query how you can use a particular resource (meaning what are my options? See http://zacstewart.com/2012/04/14/http-options-method.html), or as preflight requests in cross-domain Ajax calls (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS). You should not use it for any other purpose.