REST API Morning Checks - edmozley/freeitsm GitHub Wiki
โ๏ธ REST API: Morning Checks
The complete usage guide for the Morning Checks module of the REST API โ the daily operational checklist. Mirrors the interactive documentation at System โ API โ Documentation (with its live "Try it" tester).
[!NOTE] New to the API? The basics table on REST API: Tickets covers base URL, authentication, the response envelope, error codes, rate limits and PATCH semantics โ identical across all modules.
What's distinctive about Morning Checks:
| ๐ One result per check per day | Recording is an upsert โ POST /morning-checks/results for a check + date that already has a result overwrites it (200) rather than creating a second (a first record is a 201). That's the dashboard's exact behaviour, and it's backed by a database unique key. |
| ๐ค Built for automated checking | The whole point of exposing this module: a script that probes your backups/mail-flow/VPN each morning can record Green/Amber/Red itself, and the team dashboard fills in before anyone sits down. Results recorded via the API stamp created_by with the key's acting analyst. |
| ๐๏ธ Plain dates, not timestamps | A check happens on a day โ date values are bare YYYY-MM-DD (defaulting to today, server-local, like the dashboard). created_at/modified_at are normal UTC ISO timestamps. |
| ๐ Notes rules enforced | Statuses flagged requires notes in Settings (Red by default) reject an empty notes field with a 422 โ same rule as the dashboard's notes modal. |
| ๐ป Orphans surfaced | If an admin deletes a status option, historical results saved against it keep a label snapshot. Those rows come back with is_orphan: true + orphan_label, and ?orphans=true lists them โ the dashboard's warning-banner set. |
๐ Quick start โ an automated morning check
B="https://your-server/api/v1"; K="Authorization: Bearer fitsm_โฆ"
# What's on the board and what's already been done today?
curl -s "$B/morning-checks/board" -H "$K"
# Probe passed โ record Green for check 3
curl -s -X POST "$B/morning-checks/results" -H "$K" -H "Content-Type: application/json" \
-d '{"check_id": 3, "status": "Green"}'
# Probe failed โ Red requires notes
curl -s -X POST "$B/morning-checks/results" -H "$K" -H "Content-Type: application/json" \
-d '{"check_id": 3, "status": "Red", "notes": "Overnight Veeam job failed on VM-SQL01."}'
# Ran it again an hour later and things recovered โ same call simply overwrites today's result
curl -s -X POST "$B/morning-checks/results" -H "$K" -H "Content-Type: application/json" \
-d '{"check_id": 3, "status": "Green", "notes": "Job re-ran clean."}'
๐ The day board
๐ข GET /morning-checks/board ย ๐ morning_check_results.read
Every active check with its result for one date (?date=YYYY-MM-DD, default today) โ the dashboard's exact view. result is null for checks not yet done:
{ "data": { "date": "2026-07-03", "checks": [
{ "id": 3, "name": "Backup Status", "description": "Check overnight backup jobs completed", "sort_order": 2,
"result": { "id": 731, "status": { "id": 1, "label": "Green", "colour": "#28a745" },
"is_orphan": false, "orphan_label": null, "notes": "" } },
{ "id": 4, "name": "VPN Gateway", "description": null, "sort_order": 3, "result": null } ] } }
โ Results
๐ต POST /morning-checks/results ย ๐ morning_check_results.record
Record (or overwrite) a result โ the integration verb.
| Field | Notes |
|---|---|
check_id |
Required. Unknown ids are a 422 (the UI would 500 on the foreign key). |
status or status_id |
Required. Label (e.g. "Green") or id; must exist and be active. |
notes |
Required when the status is flagged requires notes, optional otherwise. |
date |
YYYY-MM-DD, default today. Malformed dates are a 422 โ the internal endpoint silently substitutes today, which is exactly wrong for a machine backfilling yesterday. |
201 on the first record for that check + date, 200 when overwriting an existing one (same row, status/notes replaced โ one result per check per day).
๐ข GET /morning-checks/results ย ๐ morning_check_results.read
Result history, newest date first, paginated. Filters: check_id, status_id, date (exact), from / to (inclusive bounds), and orphans=true for only the rows whose status has since been deleted.
๐ข GET /morning-checks/results/{id} ย ๐ morning_check_results.read
One result:
{ "data": { "id": 731, "check": { "id": 3, "name": "Backup Status" }, "date": "2026-07-03",
"status": { "id": 2, "label": "Amber", "colour": "#ffc107" },
"is_orphan": false, "orphan_label": null, "notes": "Minor delays on one job.",
"created_by": "Administrator", "created_at": "2026-07-03T07:02:11Z", "modified_at": "2026-07-03T08:15:40Z" } }
There is deliberately no DELETE for results โ the module has no such operation (correcting a mistake is just re-POSTing the right status for that date).
๐งพ Checks (the definitions)
๐ข GET /morning-checks/checks ย ๐ morning_checks.read
All check definitions (active and inactive) in board order. is_active=true|false filters; q searches names.
๐ต POST /morning-checks/checks ย ๐ morning_checks.create
Only name is required; description, sort_order, is_active optional.
๐ข GET ยท ๐ PATCH /morning-checks/checks/{id} ย ๐ morning_checks.read/update
PATCH sends only what changes. Deactivating (is_active: false) removes a check from the board but keeps its history โ usually what you want.
๐ด DELETE /morning-checks/checks/{id} ย ๐ morning_checks.delete
Removes the check and all its historical results, transactionally. Prefer deactivating.
๐ Reference lookup
๐ข GET /morning-check-statuses ย ๐ reference.read
The configurable status options (Green / Amber / Red by default) with colour, requires_notes and is_active โ inactive ones included so historical results always resolve:
{ "data": [ { "id": 1, "label": "Green", "colour": "#28a745", "requires_notes": false, "sort_order": 10, "is_active": true } ] }
๐ Permissions
| Group | Actions |
|---|---|
Morning checks (morning_checks) |
read ยท create ยท update ยท delete โ the check definitions |
Morning check results (morning_check_results) |
read (board + history) ยท record (the daily upsert) |
A typical monitoring key needs only morning_check_results.record (plus read if it wants to see what's outstanding first).
Morning Checks is install-wide โ no company scoping (matches the UI) โ and the module has no audit trail.