summary refs log tree commit diff
path: root/docs/admin_api/scheduled_tasks.md
diff options
context:
space:
mode:
authorShay <hillerys@element.io>2025-05-01 11:30:00 -0700
committerGitHub <noreply@github.com>2025-05-01 18:30:00 +0000
commit6dc1ecd35972c95ce62c5e0563245845c9c64e49 (patch)
treeb29bb4bd4084e22789246fa41415d6a8801c5706 /docs/admin_api/scheduled_tasks.md
parentdocs/workers.md: Add ^/_matrix/federation/v1/event/ to list of delegatable e... (diff)
downloadsynapse-6dc1ecd35972c95ce62c5e0563245845c9c64e49.tar.xz
Add an Admin API endpoint to fetch scheduled tasks (#18214)
Diffstat (limited to 'docs/admin_api/scheduled_tasks.md')
-rw-r--r--docs/admin_api/scheduled_tasks.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/docs/admin_api/scheduled_tasks.md b/docs/admin_api/scheduled_tasks.md
new file mode 100644

index 0000000000..1708871a6d --- /dev/null +++ b/docs/admin_api/scheduled_tasks.md
@@ -0,0 +1,54 @@ +# Show scheduled tasks + +This API returns information about scheduled tasks. + +To use it, you will need to authenticate by providing an `access_token` +for a server admin: see [Admin API](../usage/administration/admin_api/). + +The api is: +``` +GET /_synapse/admin/v1/scheduled_tasks +``` + +It returns a JSON body like the following: + +```json +{ + "scheduled_tasks": [ + { + "id": "GSA124oegf1", + "action": "shutdown_room", + "status": "complete", + "timestamp": 23423523, + "resource_id": "!roomid", + "result": "some result", + "error": null + } + ] +} +``` + +**Query parameters:** + +* `action_name`: string - Is optional. Returns only the scheduled tasks with the given action name. +* `resource_id`: string - Is optional. Returns only the scheduled tasks with the given resource id. +* `status`: string - Is optional. Returns only the scheduled tasks matching the given status, one of + - "scheduled" - Task is scheduled but not active + - "active" - Task is active and probably running, and if not will be run on next scheduler loop run + - "complete" - Task has completed successfully + - "failed" - Task is over and either returned a failed status, or had an exception + +* `max_timestamp`: int - Is optional. Returns only the scheduled tasks with a timestamp inferior to the specified one. + +**Response** + +The following fields are returned in the JSON response body along with a `200` HTTP status code: + +* `id`: string - ID of scheduled task. +* `action`: string - The name of the scheduled task's action. +* `status`: string - The status of the scheduled task. +* `timestamp_ms`: integer - The timestamp (in milliseconds since the unix epoch) of the given task - If the status is "scheduled" then this represents when it should be launched. + Otherwise it represents the last time this task got a change of state. +* `resource_id`: Optional string - The resource id of the scheduled task, if it possesses one +* `result`: Optional Json - Any result of the scheduled task, if given +* `error`: Optional string - If the task has the status "failed", the error associated with this failure