Search the docs
Menu
Updated Edit on GitHub

Console: maintenance

Copy as Markdown

These routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.

Maintenance windows that hold the alerts of devices while they are worked on.

GET /api/maintenance/windows

List the maintenance windows you see.

Running ones first, then upcoming by start, then past ones. An account sees only windows whose devices all lie in its device scope.

Needs device.view. neodesk maintenance windows calls it.

Parameter In Type What it is
state query string, one of running, upcoming, over Only windows in this state; running includes the grace time

200: The windows (application/json)

Field Type Required
success true yes
data object yes
data.windows array of MaintenanceWindow yes
data.total integer
data.server_zone string
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/maintenance/windows

Create a maintenance window.

While it runs, no alert rule sends an alert for its devices; the alerts are written as held. After its end and grace time a device still offline alerts once. Writes maintenance_window_created to the audit log.

Needs org.manage_devices. neodesk maintenance window-create calls it.

Request body, application/json:

MaintenanceWindowBody.

201: The window as it is stored (application/json)

Field Type Required
success true yes
data object yes
data.window MaintenanceWindow yes
Error When
400 A field is wrong (codes maintenance_name, maintenance_schedule, maintenance_scope_empty, maintenance_unknown_targets, ...)
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 A device outside your device scope (maintenance_scope), or the whole server without server.config (maintenance_whole_server)

GET /api/maintenance/windows/{id}

Show one maintenance window and the devices it holds now.

Needs device.view. neodesk maintenance window calls it.

Parameter In Type Required What it is
id path string yes The window ID (see maintenance windows)

200: The window (application/json)

Field Type Required
success true yes
data object yes
data.window MaintenanceWindow yes
data.device_ids array of string
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 No such window you can see (maintenance_not_found)

PATCH /api/maintenance/windows/{id}

Change a maintenance window.

The fields given are changed, with the checks of the create. Writes maintenance_window_changed to the audit log.

Needs org.manage_devices. neodesk maintenance window-update calls it.

Parameter In Type Required What it is
id path string yes The window ID (see maintenance windows)

Request body, application/json:

MaintenanceWindowBody.

200: The window (application/json)

Field Type Required
success true yes
data object yes
data.window MaintenanceWindow yes
Error When
400 A field is wrong
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 No such window you can see (maintenance_not_found)

DELETE /api/maintenance/windows/{id}

Delete a maintenance window.

The alerts it held stay, with its name. Writes maintenance_window_deleted to the audit log.

Needs org.manage_devices. neodesk maintenance window-delete calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The window ID (see maintenance windows)

200: Done (application/json)

ConsoleSuccess.

Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 No such window you can see (maintenance_not_found)

POST /api/maintenance/windows/{id}/end

End the running maintenance window now.

Its grace time follows. For a repeating window only the run that is on ends. Writes maintenance_window_ended_early to the audit log.

Needs org.manage_devices. neodesk maintenance window-end calls it.

Parameter In Type Required What it is
id path string yes The window ID (see maintenance windows)

Request body, application/json:

Object.

200: The window (application/json)

Field Type Required
success true yes
data object yes
data.window MaintenanceWindow yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 No such window you can see (maintenance_not_found)
409 The window is not running (maintenance_not_running)

POST /api/maintenance/windows/{id}/extend

Extend the running maintenance window.

The run that is on, or in its grace time, ends that many minutes later. Writes maintenance_window_extended to the audit log.

Needs org.manage_devices. neodesk maintenance window-extend calls it.

Parameter In Type Required What it is
id path string yes The window ID (see maintenance windows)

Request body, application/json:

Field Type Required What it is
minutes integer yes at least 1, at most 10080

200: The window (application/json)

Field Type Required
success true yes
data object yes
data.window MaintenanceWindow yes
Error When
400 Minutes out of range (maintenance_extend)
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 No such window you can see (maintenance_not_found)
409 The window is not running (maintenance_not_running)

GET /api/maintenance/devices

List the devices a maintenance window holds now.

Devices in your device scope only. A window for the whole server is answered as all.

Needs device.view. neodesk maintenance devices calls it.

Parameter In Type What it is
device_id query string Only this device

200: The held devices (application/json)

Field Type Required
success true yes
data object yes
data.devices object
data.all object or null
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

Type to search pages, sections, commands and settings.