Doku durchsuchen
Menü
Geändert am Auf GitHub bearbeiten

Konsole: tenants

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.

Tenants with their devices and users.

GET /api/tenants

List tenants.

All tenants by name.

neodesk tenants list calls it.

200: Done (application/json)

Array of Tenant.

Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"})

POST /api/tenants

Make a tenant.

The tenant is made active.

neodesk tenants create calls it.

Request body, application/json:

Field Type Required What it is
name string yes Trimmed, not empty
slug string or null Made from the name when left out, null or empty: lower case, every run of other characters than a to z and 0 to 9 a hyphen
contact_name string or null
contact_email string or null
max_devices integer or null default 0, at least 0, at most 2147483647
notes string or null

201: Created (application/json)

Tenant.

Error When
400 A field is missing or of the wrong type ("Tenant name is required", "Invalid slug")
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"}), or a write from a browser without a good CSRF token
409 The slug is taken

GET /api/tenants/{id}

Show one tenant.

Needs audit.view. neodesk tenants get calls it.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

200: Done (application/json)

Tenant.

Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"})
404 There is no such tenant

PATCH /api/tenants/{id}

Change a tenant.

neodesk tenants update calls it.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

Request body, application/json:

The fields to change. A field left out stays as it is.

Field Type What it is
name string Trimmed, not empty
slug string
contact_name string or null
contact_email string or null
max_devices integer at least 0, at most 2147483647
notes string or null
active boolean or integer, one of true, false, 1, 0

200: Done (application/json)

Tenant.

Error When
400 A field is of the wrong type
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"}), or a write from a browser without a good CSRF token
404 There is no such tenant
409 The slug is taken

DELETE /api/tenants/{id}

Delete a tenant.

Needs server.config. neodesk tenants delete calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

200: Done (application/json)

TenantOk.

Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"}), or a write from a browser without a good CSRF token
404 There is no such tenant

GET /api/tenants/{id}/devices

List a tenant's devices.

Newest assignment first. online comes from the server API. An id no tenant has gets an empty list.

neodesk tenants devices calls it.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

200: Done (application/json)

An array of object; each item:

Field Type Required What it is
[].device_id string yes
[].assigned_at string (date-time) yes
[].online boolean yes
[].hostname string yes The name the console has for the device; empty for a device it does not know or deleted
[].ip string yes Empty for a device the console does not know or deleted
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"})
404 The id is not a whole number

POST /api/tenants/{id}/devices

Add devices to a tenant.

Every device must be one the server API knows; otherwise nothing is assigned. A device the tenant has already stays as it is.

neodesk tenants device-add calls it.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

Request body, application/json:

device_ids or device_id.

Field Type What it is
device_ids array of string The devices to add; when given, device_id is not read
device_id string One device to add

200: Done (application/json)

Field Type Required What it is
ok true yes
assigned integer yes The devices the tenant did not have before
Error When
400 No device, a device id that is not text, or a device the server API does not know ("Unknown device")
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"}), or a write from a browser without a good CSRF token
404 There is no such tenant

DELETE /api/tenants/{id}/devices/{deviceId}

Take a device out of a tenant.

neodesk tenants device-remove calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"
deviceId path string yes The device's id

200: Done (application/json)

TenantOk.

Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"}), or a write from a browser without a good CSRF token
404 The tenant does not have the device ("Assignment not found")

GET /api/tenants/{id}/stats

Show a tenant's numbers.

online_devices counts the tenant's devices the server API has online.

neodesk tenants stats calls it.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

200: Done (application/json)

Field Type Required What it is
tenant_id integer yes
tenant_name string yes
total_devices integer yes
online_devices integer yes
total_users integer yes
max_devices integer yes 0 when the tenant has no limit set
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"})
404 There is no such tenant

GET /api/tenants/{id}/users

List a tenant's accounts.

Newest assignment first. An id no tenant has gets an empty list.

neodesk tenants users calls it.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

200: Done (application/json)

An array of object; each item:

Field Type Required
[].user_id integer yes
[].assigned_at string (date-time) yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"})
404 The id is not a whole number

POST /api/tenants/{id}/users

Add a console account to a tenant.

An account the tenant has already stays as it is.

neodesk tenants user-add calls it.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"

Request body, application/json:

Field Type Required What it is
user_id integer yes The console account's id, as a number; at least 1, at most 2147483647

200: Done (application/json)

TenantOk.

Error When
400 No user_id, one that is no whole number, or one no account has ("Unknown user")
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"}), or a write from a browser without a good CSRF token
404 There is no such tenant

DELETE /api/tenants/{id}/users/{userId}

Take a console account out of a tenant.

neodesk tenants user-remove calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The tenant's id: the digits of a whole number from 1 to 2147483647. Anything else is "Tenant not found"
userId path string yes The console account's id, a whole number

200: Done (application/json)

TenantOk.

Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 Not a super admin, admin or global admin ({"error": "Admin access required"}), or a write from a browser without a good CSRF token
404 The tenant does not have the account ("Assignment not found")

Durchsucht Seiten, Abschnitte, Befehle und Einstellungen.