Suppose I have Task and TimePeriod. TimePeriod represents the time I have worked on the task using start_time and end_time fields.
I would like for Task to support Starting/Stopping the task. Start will create a new TimePeriod with the current time. Stop will add end_time to the last TimePeriod.
I was thinking the REST URL will be like this:
PUT /tasks/1011?do=start
PUT /tasks/1011?do=stop
or maybe
PUT /tasks/1011/start
PUT /tasks/1011/stop
What is the proper way to make this REST style?
Here is one alternative. Retrieve the task like this,
Then to start the task, POST it like this,
and to end the task,
In reality it doesn’t matter what the URIs look like if you use the following representation for a task resource:
or
Note that only one of the links will be available at any one time, depending on whether the task is currently active