Doku durchsuchen
Menü
Geändert am Auf GitHub bearbeiten

Konsole: network

Als Markdown kopieren

Diese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als Authorization: Bearer ndt_...; siehe API-Tokens. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

Network checks: targets, monitoring, ping and port tests.

POST /api/network/http

Fetch an address from the server and show the status.

A check that fails still answers 200, with success false and the error.

Needs device.connect. neodesk network http calls it.

Request body, application/json:

Field Type Required What it is
url string yes
timeout_ms integer or string or null Milliseconds; 5000 when not given or 0; at least 1, at most 60000

200: Done (application/json)

Object and NetworkCheckResult.

Error When
400 url is missing, or the timeout is out of range
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/network/monitor/start

Start the network monitor.

The monitor checks every enabled target at its interval and keeps running after a restart of the console. A monitor that runs keeps its interval.

Needs server.config. neodesk network monitor-start calls it.

Request body, application/json:

Field Type What it is
interval_ms integer or string or null Milliseconds between two polls; 60000 when not given or 0; at least 1000, at most 2147483647

200: Done (application/json)

Field Type Required
status "started" yes
interval_ms number yes
Error When
400 interval_ms is out of range
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

GET /api/network/monitor/status

Show whether the network monitor runs.

Needs device.view. neodesk network monitor-status calls it.

200: Done (application/json)

Field Type Required
running boolean yes
interval_ms number yes
Error When
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/network/monitor/stop

Stop the network monitor.

Needs server.config. neodesk network monitor-stop calls it.

200: Done (application/json)

Field Type Required
status "stopped" yes
Error When
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/network/ping

Ping a host from the server.

A check that fails still answers 200, with success false and the error.

Needs device.connect. neodesk network ping calls it.

Request body, application/json:

Field Type Required What it is
host string yes
timeout_ms integer or string or null Milliseconds; 5000 when not given or 0; at least 1, at most 60000

200: Done (application/json)

Object and NetworkCheckResult.

Error When
400 host is missing, or the timeout is out of range
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/network/resolve

Look up the address of a host from the server.

Answers the first address the server resolves.

Needs device.connect. neodesk network resolve calls it.

Request body, application/json:

Field Type Required
host string yes

200: Done (application/json)

Field Type Required
host string yes
ip string yes
Error When
400 host is missing
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
500 The host could not be resolved, or is not text

GET /api/network/stats

Count the targets that are up and down.

avg_latency_ms is the mean of the last round trip times of the targets that have one, in milliseconds, null when none has.

Needs device.view. neodesk network stats calls it.

200: Done (application/json)

Field Type Required What it is
total integer yes
up integer yes
down integer yes
unknown integer yes Targets not checked yet
avg_latency_ms number or null yes Milliseconds
Error When
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

GET /api/network/targets

List network targets.

Needs device.view. neodesk network targets calls it.

Parameter In Type What it is
enabled query string true lists the enabled targets, any other value the disabled ones
check_type query string, one of ping, tcp, http, https

200: Done (application/json)

Array of NetworkTarget.

Error When
400 check_type is not one text
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/network/targets

Add a target to check.

Needs a host or a url.

Needs server.config. neodesk network target-create calls it.

Request body, application/json:

Field Type Required What it is
name string yes
check_type string, one of ping, tcp, http, https yes
host string
url string
port integer or string or null A whole number, or its digits; 0, "" or null for none; at least 1, at most 65535
timeout_ms integer or string or null Milliseconds; 0, "" or null for the default; at least 1, at most 60000
interval_ms integer or string or null Milliseconds between two checks; 0, "" or null for the default; at least 1, at most 2147483647
enabled boolean or integer, one of true, false, 1, 0 true or false, or 1 or 0; true when not given

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

NetworkTarget.

Error When
400 A member is missing or not valid, or the target could not be saved
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

GET /api/network/targets/{id}

Show one network target.

Needs device.view. neodesk network target calls it.

Parameter In Type Required What it is
id path string yes The target's ID

200: Done (application/json)

NetworkTarget.

Error When
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such target

PATCH /api/network/targets/{id}

Change a network target.

Changes the members the body has. A target keeps a host or a url.

Needs server.config. neodesk network target-update calls it.

Parameter In Type Required What it is
id path string yes The target's ID

Request body, application/json:

Field Type What it is
name string Not blank
check_type string, one of ping, tcp, http, https
host string or null
url string or null
port integer or string or null A whole number, or its digits; 0, "" or null for none; at least 1, at most 65535
timeout_ms integer or string or null Milliseconds; 0, "" or null for the default; at least 1, at most 60000
interval_ms integer or string or null Milliseconds between two checks; 0, "" or null for the default; at least 1, at most 2147483647
enabled boolean or integer, one of true, false, 1, 0 true or false, or 1 or 0

200: The target as it is stored now (application/json)

NetworkTarget.

Error When
400 A member is not valid, the target would have no host and no url, or it could not be saved
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such target

DELETE /api/network/targets/{id}

Delete a network target and its history.

Needs server.config. neodesk network target-delete calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The target's ID

200: Done (application/json)

Field Type Required
status "deleted" yes
Error When
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such target

POST /api/network/targets/{id}/check

Check one target now.

Runs the check from the server and stores the result in the history.

Needs device.connect. neodesk network target-check calls it.

Parameter In Type Required What it is
id path string yes The target's ID

200: Done (application/json)

Object and NetworkCheckResult.

Error When
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such target

GET /api/network/targets/{id}/history

Show the past checks of a target, the newest first.

An ID that names no target answers an empty list.

Needs device.view. neodesk network target-history calls it.

Parameter In Type Required What it is
id path string yes The target's ID
limit query integer A larger one is 500; default 100, at least 1, at most 500
from query string The first time: a date, or a date and time with or without a zone (none is UTC)
to query string The last time, written as from; a date alone takes in that whole day

200: Done (application/json)

An array of object; each item:

Field Type What it is
[].id integer
[].target_id integer
[].status string or null up or down
[].rtt_ms number or null
[].status_code number or null HTTP checks only
[].error_msg string or null
[].checked_at string or null (date-time) On SQLite the stored text, on PostgreSQL an ISO time
Error When
400 limit, from or to is not valid
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/network/tcp

Open a TCP connection from the server.

A check that fails still answers 200, with success false and the error.

Needs device.connect. neodesk network tcp calls it.

Request body, application/json:

Field Type Required What it is
host string yes
port integer or string yes at least 1, at most 65535
timeout_ms integer or string or null Milliseconds; 5000 when not given or 0; at least 1, at most 60000

200: Done (application/json)

Object and NetworkCheckResult.

Error When
400 host or port is missing, or the timeout is out of range
401 No signed-in account or API token
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

Durchsucht Seiten, Abschnitte, Befehle und Einstellungen.