Misc · Todo · Topics
Update todo topic workflow
Updates a todo topic’s workflow statuses and types using the supplied organization ID, topic ID, and revision. The endpoint returns no content on success.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Who may call it
- Callers must have organization access and the
todoTopic.editpermission.
Request
Path parameters
-
organizationIdidrequired -
topicIdidrequired
Body
Content-Type: application/json
-
revisionintegerrequiredat least 0
-
statusesobject[]required2–100 items
6 properties
-
_ididrequired -
labelstringrequired1–80 characters
-
colorstringrequired22 values
slategrayzincneutralstoneredorangeamberyellowlimegreenemeraldtealcyanskyblueindigovioletpurplefuchsiapinkrose -
rolestringrequiredregularreviewcompleted -
orderintegerrequiredat least 0
-
archivedAtstring · date-timerequirednullable
-
-
typesobject[]required1–50 items
7 properties
-
_idid -
namestringrequired1–80 characters
-
emojistringrequiredat most 16 characters
-
orderintegerrequiredat least 0
-
archivedAtstring · date-timerequirednullable -
statusesid[]required2–30 items
-
statusTransitionsobject[]requirednullableat most 30 items
2 properties
-
fromStatusidrequired -
toStatusesid[]required1–30 items
-
-
Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/misc/todo/topics/YOUR_TOPIC_ID/workflow' \
--header 'X-API-Key: YOUR_API_KEY'const response = await fetch("https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/misc/todo/topics/YOUR_TOPIC_ID/workflow", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY"
},
redirect: 'error',
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`campai HTTP ${response.status}`);
const text = await response.text();
const result = text ? JSON.parse(text) : null;
console.log(JSON.stringify(result, null, 2));<?php
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => [
'X-API-Key: YOUR_API_KEY',
],
'timeout' => 30,
'follow_location' => 0,
'ignore_errors' => true,
]]);
$text = @file_get_contents('https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/misc/todo/topics/YOUR_TOPIC_ID/workflow', false, $context);
preg_match('/^HTTP\/\S+ (\d{3})/', $http_response_header[0] ?? '', $match);
$status = (int) ($match[1] ?? 0);
if ($text === false || $status < 200 || $status >= 300) {
throw new RuntimeException("campai HTTP $status (0 means no response)");
}
$result = $text === '' ? null : json_decode($text, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR), PHP_EOL;
No request that worked has been recorded yet, so the body is not shown.
Response
200 Successful response
No response body is specified.
What else happens
- On success, updates the topic’s statuses, types, and revision in
todoTopics.
Errors
Other errors
| Status | Error | When |
|---|---|---|
| 400 | The purpose of an existing workflow status cannot be changed. Add a replacement instead. | Returns 400 BAD_REQUEST with key misc.todo.topics.invalidWorkflowUpdate if an existing status’s role is changed. |
| 404 | The todo topic was not found | Returns 404 NOT_FOUND with key misc.todo.topics.notFound if the topic is not found in the organization. |
| 409 | This topic changed while you were editing it. Reload it and apply your changes again. | Returns 409 CONFLICT with key misc.todo.topics.changed if the supplied revision does not match the topic’s revision. |
| 409 | This topic changed while you were editing it. Reload it and apply your changes again. | Returns 409 CONFLICT with key misc.todo.topics.changed if the topic no longer matches the expected revision when the update is saved. |
| 409 | Assign an eligible reviewer to every existing Todo of this type before enabling review. Reopen completed Todos to edit their reviewer. | Returns 409 CONFLICT with key misc.todo.topics.reviewersRequired if review is being enabled for a type and an existing Todo of that type lacks an eligible reviewer. |
| 409 | Types used by Todos must keep an active regular status, one completion status and at most one review status. | Returns 409 CONFLICT with key misc.todo.topics.workflowInUse if a type used by Todos has no regular status, not exactly one completion status, or more than one review status. |
| 409 | Status “status” is still used by Todos. Archive it instead. | Returns 409 CONFLICT with key misc.todo.topics.statusInUse if a removed status is still referenced by a Todo. |
| 409 | Status “status” cannot be removed from type “type” because Todos of that type still use it. | Returns 409 CONFLICT with key misc.todo.topics.typeStatusInUse if a status is removed from a type while a Todo of that type still references it. |
| 409 | Type “type” is still used by Todos. Archive it instead. | Returns 409 CONFLICT with key misc.todo.topics.typeInUse if a removed type is still used by a Todo. |
Marked words such as status are filled in with the actual value when the error happens.
Errors nearly every request can meet are listed under Errors.