Doku durchsuchen
Menü
Geändert am Auf GitHub bearbeiten

Server-API: meshcentral

Als Markdown kopieren

Diese Routen liegen auf der Server-API, Port 21114 (21121 in Docker). Sie nehmen einen API-Schlüssel in X-API-Key oder ein Anmelde-Token; siehe Die HTTP-API. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

MeshCentral support: devices that run a MeshAgent, their groups, relays for desktop, terminal, files and ports, power actions, commands, share links and recordings.

POST /api/mesh/devices/{id}/desktop

Open a relay to a MeshCentral device's desktop.

On the server API, port 21114. Needs device.connect.

Parameter In Type Required What it is
id path string yes The device ID
mesh_share query string A share link token: the relay opens as the link's maker, view only when the link is
guest query string A guest access link token: the relay opens as the link's maker, view only when the link is
view_only query string true or 1 for a relay without input
record query string true or 1 to record the session on the server
relay_base query string The path the relay address starts with; / when missing

200: The relay (application/json)

MeshTunnel.

Error When
400 The mesh agent is not connected, or the agent refused
401 No credential, or one that is not valid
403 A share or guest token is not valid for the device, or the caller does not see the device
404 MeshCentral support is off

POST /api/mesh/devices/{id}/exec

Run a command on a MeshCentral device.

Hands the command to the mesh agent and answers at once; the output does not come back here.

On the server API, port 21114. Needs mesh.terminal.

Parameter In Type Required What it is
id path string yes The device ID

Request body, application/json:

Field Type What it is
command string
shell boolean run it in the shell (type 1 of the agent)

200: Sent (application/json)

Field Type
status "sent"
Error When
400 The body is not valid JSON, the mesh agent is not connected, or the agent refused
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

POST /api/mesh/devices/{id}/files

Open a relay to the files of a MeshCentral device.

On the server API, port 21114. Needs mesh.files.

Parameter In Type Required What it is
id path string yes The device ID
relay_base query string The path the relay address starts with; / when missing

200: The relay (application/json)

MeshTunnel.

Error When
400 The mesh agent is not connected, or the agent refused
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

POST /api/mesh/devices/{id}/group

Move a MeshCentral device to another group.

Saves the group for the device and applies it to a connected agent. The group ID is not checked against the groups.

On the server API, port 21114. Needs server.config.

Parameter In Type Required What it is
id path string yes The device ID

Request body, application/json:

Field Type Required What it is
group_id string yes the group ID; empty removes the device from its group

200: Moved (application/json)

Field Type
status "ok"
group_id string
Error When
400 The body is not valid JSON, or the group could not be saved
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

POST /api/mesh/devices/{id}/power

Wake, sleep, restart or turn off a MeshCentral device.

A wake for a device whose agent is offline goes out as a Wake-on-LAN packet when a MAC address is known, and is written in the audit log.

On the server API, port 21114. Needs mesh.power.

Parameter In Type Required What it is
id path string yes The device ID

Request body, application/json:

Field Type Required What it is
action string yes wake (or wakeup, on), sleep, off (or poweroff, shutdown) or reset (or reboot); any letter case
forced boolean force the action on the agent
mac string for wake of a device whose agent is offline: the MAC address for Wake-on-LAN; else the one the server knows of the device or its linked device

200: Sent (application/json)

Field Type What it is
status "sent"
action string
transport "wol" wol when the device was offline and a Wake-on-LAN packet went out
mac string The MAC address the Wake-on-LAN packet went to
Error When
400 The body or action is not valid, or the mesh agent is not connected
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off
500 The Wake-on-LAN packet could not be sent

POST /api/mesh/devices/{id}/share

Make a share link to a MeshCentral device's desktop.

The mesh agent must be connected. A link made with an API key or sign-in token ends with that token.

On the server API, port 21114. Needs device.connect.

Parameter In Type Required What it is
id path string yes The device ID

Request body, application/json:

Field Type What it is
ttl_minutes integer how long the link works; 60 when missing or 0, at most 1440; at most 1440
view_only boolean

200: The link (application/json)

Field Type What it is
token string
path string The console page for the link: /remote/<id>?transport=mesh&mesh_share=<token>
view_only boolean
ttl_minutes integer ttl_minutes as the request gave it
Error When
400 The body is not valid JSON, the mesh agent is not connected, or the agent refused
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

POST /api/mesh/devices/{id}/tcp

Open a TCP port relay through a MeshCentral device.

On the server API, port 21114. Needs device.connect.

Parameter In Type Required What it is
id path string yes The device ID
relay_base query string The path the relay address starts with; / when missing

Request body, application/json:

Field Type Required What it is
host string the address the agent connects to; 127.0.0.1 when missing
port integer yes at least 1, at most 65535

200: The relay (application/json)

MeshTunnel.

Error When
400 The body or port is not valid, or the mesh agent is not connected
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

POST /api/mesh/devices/{id}/terminal

Open a relay to a terminal of a MeshCentral device.

On the server API, port 21114. Needs mesh.terminal.

Parameter In Type Required What it is
id path string yes The device ID
relay_base query string The path the relay address starts with; / when missing

200: The relay (application/json)

MeshTunnel.

Error When
400 The mesh agent is not connected, or the agent refused
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

POST /api/mesh/devices/{id}/udp

Open a UDP port relay through a MeshCentral device.

On the server API, port 21114. Needs device.connect.

Parameter In Type Required What it is
id path string yes The device ID
relay_base query string The path the relay address starts with; / when missing

Request body, application/json:

Field Type Required What it is
host string the address the agent connects to; 127.0.0.1 when missing
port integer yes at least 1, at most 65535

200: The relay (application/json)

MeshTunnel.

Error When
400 The body or port is not valid, or the mesh agent is not connected
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

GET /api/mesh/download.msh

Download the MeshAgent settings file (.msh).

Answers the file as an attachment named meshagents.msh.

On the server API, port 21114. Needs server.config.

Parameter In Type What it is
name query string the device group name; NeoDesk Mesh when missing
mesh_id query string the MeshCentral group ID, 64 or 96 hexadecimal characters; the default group when missing
mesh_server query string the agent address the file names; wss://<host of the request>/agent.ashx when missing

200: The .msh file (application/octet-stream)

String (binary).

Error When
400 mesh_id is not valid
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off
500 The group has no mesh ID

GET /api/mesh/groups

List the MeshCentral device groups.

Gives a group without a mesh_id one and saves it.

On the server API, port 21114. Needs server.config.

200: The groups (application/json)

Field Type
groups array of MeshGroup
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

POST /api/mesh/groups

Replace the MeshCentral device groups.

The list replaces all groups. The default group can't be removed.

On the server API, port 21114. Needs server.config.

Request body, application/json:

Field Type Required What it is
groups array of MeshGroup yes All groups; the default group must be among them

200: Saved (application/json)

Field Type
status "ok"
Error When
400 The body is not valid, a group ID is not valid, or the default group is missing
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off
500 The groups could not be saved

GET /api/mesh/recordings

List the MeshCentral session recordings.

Lists every recording; the list is not narrowed to the devices the caller sees.

On the server API, port 21114. Needs device.view.

200: The recordings (application/json)

Field Type What it is
recordings array of MeshRecording or null null when the server has no recordings folder
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off
500 The recordings folder could not be read

GET /api/mesh/recordings/{id}

Download a MeshCentral session recording.

The download is written in the audit log. The device of the recording is not checked against the caller's scope.

On the server API, port 21114. Needs device.connect.

Parameter In Type Required What it is
id path string yes The recording ID (its file name)

200: The recording (application/octet-stream)

String (binary).

Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 No such recording, or MeshCentral support is off

GET /api/mesh/server-id

Show the MeshCentral server's ID.

On the server API, port 21114. Needs server.config.

200: The server ID (application/json)

Field Type
server_id string
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
404 MeshCentral support is off

GET /api/mesh/share/validate

Check a MeshCentral share link.

Asks no permission, only a valid API key or sign-in token; the console calls it for visitors who open a share link.

On the server API, port 21114.

Parameter In Type Required What it is
token query string yes The link's token
peer_id query string yes The device the link is for

200: The link works (application/json)

Field Type
valid true
peer_id string
view_only boolean
expires_at string (date-time)
Error When
400 token or peer_id is missing
403 The link is not valid for the device or has expired
404 MeshCentral support is off

GET /api/mesh/status

Show whether MeshCentral support runs, with the agents online and the agent certificate.

On the server API, port 21114. Needs device.view.

200: The state (application/json)

Only enabled when MeshCentral support is off

Field Type What it is
enabled boolean
core_version string
agents_online integer
server_id string
cert_file string The path of the agent certificate
cert_present boolean
cert_modified string or null (date-time) When the certificate file changed, RFC 3339; empty without the file
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission

GET /api/session/recordings

List the session recordings the server keeps.

Today these are the MeshCentral recordings; an empty list when MeshCentral support is off. The list is not narrowed to the devices the caller sees.

On the server API, port 21114. Needs device.view.

200: The recordings (application/json)

Field Type What it is
recordings array of MeshRecording
note string Says that recordings of CDAP and RustDesk sessions stay in the browser
Error When
401 No credential, or one that is not valid
403 The credential's role lacks the permission
500 The recordings folder could not be read

Durchsucht Seiten, Abschnitte, Befehle und Einstellungen.