Actions
Add task(s) to the Actions collection.
Input to add one or more Task items to the Actions collection (in other words, enqueue).
Condition
- requires all items in the list to be valid Task items with all required attributes; otherwise rejects whole list and returns 422 Conflict.
- requires the Actions collection to have free memory slots to enqueue the new items;
completed, stopped, or failed items in the collection may be removed (oldest first);
otherwise,
- if number of items send by client exceeds maximum number of items in collection, rejects whole list and returns 409 Conflict
- else if not enough items can be freed, rejects whole list and returns 503 Service Unavailable
On Success
- enqueues the tasks given in the data array
- each Task item is given a unique id
- each Task item is given a status attribute that is initialized with pending
- returns 200 OK listing all items enqueued with ID and status
On Failure
Returns one of the following:
- 409 Conflict, when the request contains more items than the maximum total number of items for the collection
- 415 Unsupported Media Type, when the request content type is not application/vnd.api+json, TODO: allow application/json or empty (tolerant server)
- 422 Unprocessable Content, when invalid items are included or required task-specific attributes are missing
- 503 Service Unavailable, when no more items can be enqueued (but the number of items in the request does not exceed the maximum)
General Background Logic (amended by task-specific background logic)
- when a Task item is executed, its status attribute changes to active
- when a Task item completes successfully, its status attribute changes to completed
- when a Task item completes unsuccessfully, its status attribute changes to stopped
- when a Task item fails, its status attribute changes to failed
post/api/actions
Response
Task accepted and queue for execution.