Console: reports
Copy as MarkdownThese routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.
Reports and trends.
Make a report.
Needs audit.view. Makes the report and answers it, without keeping it. The dated reports (activity, security, tickets, network, alerts) cover the period; devices and inventory show the current state. The activity report covers at most 366 days. An account limited to some devices gets reports of those devices.
neodesk reports generate calls it.
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
type |
string, one of devices, activity, security, tickets, network, inventory, alerts |
yes | |
from |
string | Start of the period: a date (the start of that day in UTC) or an ISO time; none when empty | |
to |
string | End of the period: a date (the end of that day in UTC) or an ISO time; none when empty | |
fields |
array of string | Device fields to add as columns of the device lists, by key (devices and security reports); only fields the account sees, else 400 device_field_unknown_field; at most 20 items | |
group_by |
string | A device field to group the devices by, by key (devices report) |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | type is missing (Report type is required), names no report (Unknown report type: ...), or from or to is no date or time (from must be a date or a time) |
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view (Permission denied: audit.view) |
Make a report as CSV (use --output).
Needs audit.view. Makes the report as a CSV file. With section, the rows are the list data[section] of the report; without one, the one row holds the report's top-level values that are no objects. The dated reports (activity, security, tickets, network, alerts) cover the period; devices and inventory show the current state. The activity report covers at most 366 days. An account limited to some devices gets reports of those devices.
neodesk reports csv calls it.
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
type |
string, one of devices, activity, security, tickets, network, inventory, alerts |
yes | |
from |
string | Start of the period: a date (the start of that day in UTC) or an ISO time; none when empty | |
to |
string | End of the period: a date (the end of that day in UTC) or an ISO time; none when empty | |
section |
string | The list in the report's data to export, such as banned_devices or recent_audit | |
fields |
array of string | Device fields to add as columns of the device lists, by key (devices and security reports); only fields the account sees, else 400 device_field_unknown_field; at most 20 items | |
group_by |
string | A device field to group the devices by, by key (devices report) |
200: The file <type>-report-<YYYY-MM-DD>.csv, the day in the server's time zone (text/csv)
String (binary).
| Error | When |
|---|---|
| 400 | type is missing (Report type is required), names no report (Unknown report type: ...), or from or to is no date or time (from must be a date or a time) |
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view (Permission denied: audit.view) |
Make a report and keep it.
Needs audit.view, and super admin, admin or global admin. Makes the report and keeps it. The dated reports (activity, security, tickets, network, alerts) cover the period; devices and inventory show the current state. The activity report covers at most 366 days. An account limited to some devices gets reports of those devices.
neodesk reports save calls it.
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
type |
string, one of devices, activity, security, tickets, network, inventory, alerts |
yes | |
from |
string | Start of the period: a date (the start of that day in UTC) or an ISO time; none when empty | |
to |
string | End of the period: a date (the end of that day in UTC) or an ISO time; none when empty | |
title |
string | The label and time of the report when missing, null or empty | |
fields |
array of string | Device fields to add as columns of the device lists, by key (devices and security reports); only fields the account sees, else 400 device_field_unknown_field; at most 20 items | |
group_by |
string | A device field to group the devices by, by key (devices report) |
201: The report as saved; null when it could not be read back (application/json)
| Error | When |
|---|---|
| 400 | type is missing or unknown, from or to is no date, or title is no text (Title must be text) |
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or for this route is not a super admin, admin or global admin (Admin access required) |
List kept reports.
Needs audit.view. Newest first. An account limited to some devices sees only the reports it saved itself.
neodesk reports saved calls it.
200: Done (application/json)
Array of SavedReport.
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view (Permission denied: audit.view) |
Show a kept report.
Needs audit.view. Answers the saved report with its payload parsed. An account limited to some devices sees only the reports it saved itself.
neodesk reports saved-get calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The saved report id |
200: Done (application/json)
| Field | Type | What it is |
|---|---|---|
id |
integer | |
title |
string or null | |
report_type |
string, one of devices, activity, security, tickets, network, inventory, alerts |
|
filters |
string or object | The period as JSON: text on SQLite, an object on PostgreSQL |
created_by |
string | The username of whoever saved it |
created_at |
string (date-time) | As the database holds it |
payload |
object | The report's data; {} when it is no JSON |
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view (Permission denied: audit.view) |
| 404 | There is no such report, or the account may not read it (Saved report not found) |
Delete a kept report.
Needs audit.view, and super admin, admin or global admin.
neodesk reports saved-delete calls it. It cannot be undone.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The saved report id |
200: Done (application/json)
| Field | Type |
|---|---|
ok |
true |
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or for this route is not a super admin, admin or global admin (Admin access required) |
| 404 | There is no such report (Report not found) |
Show a kept report's schedule, its last run and its next.
Needs audit.view, and super admin, admin or global admin. An account limited to some devices reaches only the reports it saved itself. Not wrapped in success and data.
Needs audit.view, as super_admin, admin or global_admin. neodesk reports schedule calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The saved report id |
200: Done (application/json)
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or is not a super admin, admin or global admin (Admin access required) |
| 404 | There is no such report, or the account may not read it (Saved report not found) |
| 500 | The schedule could not be read or saved (Failed to read the schedule) |
Mail a kept report to people every day, week or month.
Needs audit.view, and super admin, admin or global admin. Sets the whole schedule, and the account becomes its owner: the recipients get the report as that account may see it, and the schedule stops when the account is disabled or may no longer read reports. Each mail carries the report for the period that just ended, as a CSV file. The time of day is read in the server's time zone. When the timing or enabled changes, the first run is the next slot after this save; a save of the recipients alone keeps the next run. recipients, users and emails are added together and the same recipient counts once. Logs report_schedule_saved in the audit log. Answers as the GET does.
Needs audit.view, as super_admin, admin or global_admin. neodesk reports schedule-set calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The saved report id |
Request body, application/json:
| Field | Type | Required | What it is |
|---|---|---|---|
enabled |
boolean | default true |
|
frequency |
string, one of daily, weekly, monthly |
yes | |
weekday |
integer | Required for weekly: 0 (Sunday) to 6; at least 0, at most 6 | |
day |
integer | Required for monthly: 1 to 31 (the last day in a shorter month); at least 1, at most 31 | |
time_of_day |
string | yes | The time of day in the server's time zone, like 08:00 |
recipients |
array of ReportScheduleRecipient | Accounts and addresses, each an object with user or email | |
users |
array of string | More accounts to mail, by username; each must exist | |
emails |
array of string (email) | More addresses to mail | |
format |
string, one of csv |
The attached file; pdf is refused | |
fields |
array of string | Device fields to add as columns of the device lists, by key (devices and security reports); only fields the account sees, else 400 device_field_unknown_field; at most 20 items | |
group_by |
string | A device field to group the devices by, by key (devices report) |
200: Done (application/json)
| Error | When |
|---|---|
| 400 | The body could not be read, or the schedule is not valid: a frequency other than daily, weekly or monthly, a missing or wrong weekday or day, a time_of_day that is no time like 08:00, a format other than csv, an account that does not exist, an address that is not valid, a recipient with both user and email, no recipient or more than 50 |
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or is not a super admin, admin or global admin (Admin access required) |
| 404 | There is no such report, or the account may not read it (Saved report not found) |
| 500 | The schedule could not be read or saved (Failed to save the schedule) |
Remove a kept report's schedule.
Needs audit.view, and super admin, admin or global admin. Logs report_schedule_removed in the audit log.
Needs audit.view, as super_admin, admin or global_admin. neodesk reports schedule-delete calls it. It cannot be undone.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The saved report id |
200: Done (application/json)
| Field | Type | Required |
|---|---|---|
ok |
true |
yes |
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or is not a super admin, admin or global admin (Admin access required) |
| 404 | There is no such report, the account may not read it (Saved report not found), or the report has no schedule (This report has no schedule) |
| 500 | The schedule could not be read or saved (Failed to remove the schedule) |
Mail a kept report to its schedule's recipients now.
Needs audit.view, and super admin, admin or global admin. Sends the report for the period a run at this moment covers: the day before for a daily schedule, the seven days before for a weekly one, the last full month for a monthly one. It works while the schedule is off and does not replace the period's own run. A failure is kept as the schedule's last_error too.
Needs audit.view, as super_admin, admin or global_admin. neodesk reports schedule-send calls it.
| Parameter | In | Type | Required | What it is |
|---|---|---|---|---|
id |
path | integer | yes | The saved report id |
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
ok |
true |
yes | |
sent |
integer | yes | How many recipients got the report |
from |
string (date-time) | yes | The start of the period the report covers |
to |
string (date-time) | yes | The end of the period |
| Error | When |
|---|---|
| 400 | The schedule has no valid timing (The schedule has no valid timing. Save it again), or the report could not be made or mailed (the reason, such as mail that is not set up) |
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or is not a super admin, admin or global admin (Admin access required) |
| 404 | There is no such report, the account may not read it (Saved report not found), or the report has no schedule (This report has no schedule) |
| 500 | The schedule could not be read or saved (Failed to read the schedule) |
List the accounts a schedule can mail.
Needs audit.view, and super admin, admin or global admin. Every account that is not disabled, by username, with whether it has an address (never the address). An account without one gets nothing. Not wrapped in success and data.
Needs audit.view, as super_admin, admin or global_admin. neodesk reports schedule-recipients calls it.
200: Done (application/json)
By username
An array of object; each item:
| Field | Type | Required |
|---|---|---|
[].username |
string | yes |
[].has_email |
boolean | yes |
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or is not a super admin, admin or global admin (Admin access required) |
| 500 | The accounts could not be read (Failed to read the accounts) |
List the schedules of the kept reports.
Needs audit.view, and super admin, admin or global admin. Only the schedules of the reports the account may read: an account limited to some devices sees those of the reports it saved itself. Not wrapped in success and data.
Needs audit.view, as super_admin, admin or global_admin. neodesk reports schedules calls it.
200: Done (application/json)
An array of object; each item:
| Field | Type | Required | What it is |
|---|---|---|---|
[].report_id |
integer | yes | |
[].enabled |
boolean | yes | |
[].frequency |
string, one of daily, weekly, monthly |
yes | |
[].weekday |
integer | yes | The day of a weekly schedule, 0 (Sunday) to 6 |
[].day |
integer | yes | The day of a monthly schedule, 1 to 31 |
[].time_of_day |
string | yes | HH:MM in the server's time zone |
[].recipients |
integer | yes | How many recipients it has |
[].owner |
string | yes | |
[].next_at |
string or null (date-time) | yes | When it runs next; null while it is off |
[].last_error |
string or null | yes | Why the last run failed |
[].stopped |
string, one of ``, owner_missing, owner_disabled, owner_no_access |
yes | Why the server turned it off; empty otherwise |
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view, or is not a super admin, admin or global admin (Admin access required) |
| 500 | The schedules could not be read (Failed to read the schedules) |
Show the remote sessions and help requests of the last days.
The remote sessions and help requests of the last days, for the charts of the reports page. The result is kept for five minutes for every account. An account limited to some devices gets the sessions and counts of those.
Needs audit.view. neodesk reports trends calls it.
| Parameter | In | Type | What it is |
|---|---|---|---|
days |
query | integer | How many days back; cut to 1 to 90, and 14 for 0 or anything that is no number; default 14, at least 1, at most 90 |
200: Done (application/json)
| Field | Type | What it is |
|---|---|---|
success |
true |
|
data |
object | |
data.days |
integer | |
data.since |
string (date-time) | Start of the period |
data.sessions |
array of object | Remote sessions that started in the period |
data.sessions[].started_at |
string (date-time) | |
data.sessions[].ended_at |
string or null (date-time) | null while the session runs |
data.help |
array of object | Help requests made or changed in the period; null for a time that cannot be read |
data.help[].created_at |
string or null (date-time) | |
data.help[].updated_at |
string or null (date-time) | |
data.help[].status |
string | |
data.devicesChecked |
integer | Devices whose sessions were read |
data.devicesTotal |
integer | |
generatedAt |
string (date-time) | When the result was collected |
| 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 |
| 500 | Something failed on the server (the text of errors.server_error) |
| 502 | The sessions or help requests could not be read |
List the device fields a report can show.
The device fields the account sees, which it may pick as report columns and to group by: the server's first, then each organization's. Restricted fields need device.fields_restricted; an organization's fields membership of it or a server-level role. Fields of different organizations can share a key.
Needs audit.view. neodesk reports device-fields calls it.
200: Done (application/json)
| Field | Type | Required | What it is |
|---|---|---|---|
fields |
array of object | yes | |
fields[].key |
string | yes | |
fields[].label |
string | yes | |
fields[].type |
string | yes | |
fields[].org_id |
string | yes | |
fields[].restricted |
boolean | yes | |
types |
array of string | yes | The report types that show device fields |
max_columns |
integer | yes |
List the kinds of report.
Needs audit.view.
neodesk reports types calls it.
200: Done (application/json)
An array of object; each item:
| Field | Type |
|---|---|
[].type |
string, one of devices, activity, security, tickets, network, inventory, alerts |
[].label |
string |
| Error | When |
|---|---|
| 401 | No session or API token (Authentication required), or a token that is not valid |
| 403 | The account lacks audit.view (Permission denied: audit.view) |