From f3e4a0c69dc5e80f4bbccf592844fd5bc3f3b9e7 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Sat, 14 Aug 2021 11:05:44 -0600 Subject: [PATCH] Document CAS on POST /state --- projects/jobq/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/jobq/README.md b/projects/jobq/README.md index 163fecf..de56d06 100644 --- a/projects/jobq/README.md +++ b/projects/jobq/README.md @@ -94,10 +94,12 @@ $ curl -X GET $JOBQ/api/v0/job/1 | jq . ``` ### POST /api/v0/job//state -Alter the state of a given job, appending a state change event to the log and returning the entire updated job. +POST the 'current' state, and a proposed new state, attempting to update the state of the job using CAS. +If the state of the job updates successfully, a new event will be appended to the job's log and the resulting job will be returned. +Otherwise a conflict will be signaled. ``` shell -$ curl -X POST $JOBQ/api/v0/job/1/state --data '["ASSIGNED"]' | jq . +$ curl -X POST $JOBQ/api/v0/job/1/state --data '{"new": ["ASSIGNED"], "old": ["CREATED"]}' | jq . { "id": 1, "payload": {