Updating a Plan¶
Changes on a planning model might require an update of the plan status. During a running plan, no model upload, model update and no structure update are possible. So in this case the status has to be updated.
Warning
There are some restrictions when changing the 'status' of the plan:
Only the following transitions are allowed:
current status | new status |
---|---|
NOT_STARTED | RUNNING |
RUNNING | PAUSED |
PAUSED | RUNNING |
RUNNING | FINISHED |
FINISHED | NOT_STARTED |
FINISHED | EXPORTED |
EXPORTED | NOT_STARTED |
The change of the status to 'RUNNING' is only allowed when
- a planning model is present
- at least one editor is present
- at least one form exists in the plan
It is also possible to change the title or the end date of the plan.
The update of a plan can be performed with a PATCH-request:
curl --silent --show-headers --request PATCH \
--header "Authorization:Bearer ${TOKEN}" \
--header "Content-Type:application/json-patch+json" \
--data JSON_PATCH \
"${PLAN_LINK}"
JSON_PATCH is a place holder for the following use cases:
-
changing the title:
[ { "op": "replace", "path": "/title", "value": "new Title" } ]
-
changing the end date:
[ { "op": "replace", "path": "/endDate", "value": "new end date" } ]
-
changing the status:
To pause a plan you have to set the status of a running plan to "PAUSED". To resume then to a running plan you have to set the status to "RUNNING".[ { "op": "replace", "path": "/status", "value": "updated status" } ]
-
You can update more than one field within one request:
[ { "op": "replace", "path": "/title", "value": "new Title" }, { "op": "replace", "path": "/status", "value": "RUNNING" } ]