التنبيهات
قواعد التنبيه من القوالب أو بتعريف مخصص، والتنبيهات وتأكيدها وإغلاقها.
عنوان الأساسhttps://api.ping.nml.sa/v111 عملية
الانتقال إلى عملية
الأخطاء المشتركة
تُرجع عمليات هذه الصفحة هذه الأخطاء بصيغة واحدة، وتذكر كل عملية الأخطاء التي تُرجعها.
400The request is invalid (code: invalid_request), with field errors.401The API key is missing, unknown, expired or revoked (code: unauthorized).403The API key lacks the scope this operation needs (code: forbidden).404No such resource in this account, or outside the key's data scope (code: not_found).409The resource is not in a state that allows this (code: conflict), or the idempotency key is in use.429The key's rate limit is reached (code: rate_limited). Retry after the Retry-After header's seconds.
قائمة التنبيهات.
GET/v1/alarms
Alarms opened by the account's rules, newest first. A department-scoped key sees only alarms on its own vehicles.
النطاقrules:read
المعاملات
limitintegerالاستعلامItems per page, 1 to 200 (default 50).
cursorstringالاستعلامThe next_cursor of the previous page.
statusstringالاستعلامOnly alarms in this status.
مثال:
ackedseveritystringالاستعلامOnly alarms of this severity.
مثال:
warningvehicle_idstringالاستعلامOnly alarms on this vehicle.
مثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9drule_idstringالاستعلامOnly alarms opened by this rule.
مثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0akindstringالاستعلامOnly alarms of this kind (a template id, or custom).
مثال:
overspeedfromstring (date-time)الاستعلامOnly alarms seen at or after this time (their last occurrence).
مثال:
2026-11-10T00:00:00Ztostring (date-time)الاستعلامOnly alarms opened before this time.
مثال:
2026-11-17T00:00:00Z
الاستجابة 200
dataobject[]حقول data
idstringمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
مثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringمثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
مثال:
overspeedseveritystringأحد:
infowarningcriticalstatusstringopen, then acked (optional), then closed.
أحد:
openackedclosedopened_atstring (date-time)مثال:
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
مثال:
2026-11-17T08:41:00Zoccurrencesintegerمثال:
2assigneestring | nullThe account user the alarm is given to.
مثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
مثال:
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)مثال:
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
مثال:
nullclosed_atstring | null (date-time)مثال:
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
مثال:
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
مثال:
120factsobject[]The facts that held when it opened.
حقول facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhnumbernumberمثال:
134textstringمثال:
openbooleanbooleanمثال:
true
next_cursorstring | nullمثال:
eyJpZCI6InZlaF83S3EyIn0
الأخطاء
curl "https://api.ping.nml.sa/v1/alarms" \
-H "Authorization: Bearer $PING_API_KEY"{
"data": [
{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}
],
"next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}بيانات تنبيه.
GET/v1/alarms/{alarmId}
One alarm with its lifecycle and its activity, oldest first: opened, repeated, acknowledged, assigned, commented, closed and reopened, with who and when.
النطاقrules:read
المعاملات
alarmIdstringالمسار مطلوبمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
الاستجابة 200
idstringمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
مثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringمثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
مثال:
overspeedseveritystringأحد:
infowarningcriticalstatusstringopen, then acked (optional), then closed.
أحد:
openackedclosedopened_atstring (date-time)مثال:
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
مثال:
2026-11-17T08:41:00Zoccurrencesintegerمثال:
2assigneestring | nullThe account user the alarm is given to.
مثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
مثال:
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)مثال:
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
مثال:
nullclosed_atstring | null (date-time)مثال:
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
مثال:
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
مثال:
120factsobject[]The facts that held when it opened.
حقول facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhnumbernumberمثال:
134textstringمثال:
openbooleanbooleanمثال:
true
activityobject[]Oldest first.
حقول activity
idstringمثال:
019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2catstring (date-time)مثال:
2026-11-17T08:34:10Zkindstringأحد:
openedrepeatedackedassignedcommentedclosedreopenedactorstring | nullWho did it (user:<id>); null when the platform did.
مثال:
user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bassigneestring | nullمثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bresolutionstring | nullnotestring | nullمثال:
nulloccurrenceinteger | nullمثال:
null
الأخطاء
curl "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b" \
-H "Authorization: Bearer $PING_API_KEY"{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
],
"activity": [
{
"id": "019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2c",
"at": "2026-11-17T08:34:10Z",
"kind": "assigned",
"actor": "user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"resolution": "actioned",
"note": null,
"occurrence": null
}
]
}تأكيد استلام تنبيه.
POST/v1/alarms/{alarmId}/ack
Moves an open alarm to acked and records who acknowledged it and when, with an optional note. Any other status answers 409.
النطاقrules:write
المعاملات
alarmIdstringالمسار مطلوبمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
محتوى الطلب
notestringمثال:
Driver called.
الاستجابة 200
idstringمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
مثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringمثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
مثال:
overspeedseveritystringأحد:
infowarningcriticalstatusstringopen, then acked (optional), then closed.
أحد:
openackedclosedopened_atstring (date-time)مثال:
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
مثال:
2026-11-17T08:41:00Zoccurrencesintegerمثال:
2assigneestring | nullThe account user the alarm is given to.
مثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
مثال:
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)مثال:
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
مثال:
nullclosed_atstring | null (date-time)مثال:
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
مثال:
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
مثال:
120factsobject[]The facts that held when it opened.
حقول facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhnumbernumberمثال:
134textstringمثال:
openbooleanbooleanمثال:
true
الأخطاء
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/ack" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"note": "Driver called."}'{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}إسناد تنبيه إلى مستخدم.
POST/v1/alarms/{alarmId}/assign
Gives an open or acked alarm to one of the account's users. An open alarm is acknowledged by the caller as it is assigned. A closed alarm answers 409.
النطاقrules:write
المعاملات
alarmIdstringالمسار مطلوبمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
محتوى الطلب
assigneestringمطلوبAn account user id.
مثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b
الاستجابة 200
idstringمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
مثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringمثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
مثال:
overspeedseveritystringأحد:
infowarningcriticalstatusstringopen, then acked (optional), then closed.
أحد:
openackedclosedopened_atstring (date-time)مثال:
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
مثال:
2026-11-17T08:41:00Zoccurrencesintegerمثال:
2assigneestring | nullThe account user the alarm is given to.
مثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
مثال:
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)مثال:
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
مثال:
nullclosed_atstring | null (date-time)مثال:
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
مثال:
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
مثال:
120factsobject[]The facts that held when it opened.
حقول facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhnumbernumberمثال:
134textstringمثال:
openbooleanbooleanمثال:
true
الأخطاء
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/assign" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b"}'{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}إغلاق تنبيه مع ملاحظة.
POST/v1/alarms/{alarmId}/close
Closes an open or acked alarm and records who closed it, when, the resolution (actioned or false positive) and the note. A closed alarm answers 409.
النطاقrules:write
المعاملات
alarmIdstringالمسار مطلوبمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
محتوى الطلب
resolutionstringمطلوبأحد:
actionedfalse_positivenotestringمطلوبمثال:
Driver called; speed back to limit.
الاستجابة 200
idstringمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
مثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringمثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
مثال:
overspeedseveritystringأحد:
infowarningcriticalstatusstringopen, then acked (optional), then closed.
أحد:
openackedclosedopened_atstring (date-time)مثال:
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
مثال:
2026-11-17T08:41:00Zoccurrencesintegerمثال:
2assigneestring | nullThe account user the alarm is given to.
مثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
مثال:
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)مثال:
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
مثال:
nullclosed_atstring | null (date-time)مثال:
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
مثال:
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
مثال:
120factsobject[]The facts that held when it opened.
حقول facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhnumbernumberمثال:
134textstringمثال:
openbooleanbooleanمثال:
true
الأخطاء
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/close" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"resolution": "actioned", "note": "Driver called; speed back to limit."}'{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}إضافة ملاحظة إلى تنبيه.
POST/v1/alarms/{alarmId}/comments
Adds a note to the alarm's activity, whatever its status.
النطاقrules:write يقبل Idempotency-Key
المعاملات
alarmIdstringالمسار مطلوبمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1bIdempotency-KeystringالترويسةA unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.
محتوى الطلب
textstringمطلوبمثال:
Called the driver; he is pulling over.
الاستجابة 201
idstringمثال:
019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2catstring (date-time)مثال:
2026-11-17T08:34:10Zkindstringأحد:
openedrepeatedackedassignedcommentedclosedreopenedactorstring | nullWho did it (user:<id>); null when the platform did.
مثال:
user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bassigneestring | nullمثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7bresolutionstring | nullnotestring | nullمثال:
nulloccurrenceinteger | nullمثال:
null
الأخطاء
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/comments" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Called the driver; he is pulling over."}'{
"id": "019ac0c7-3d4e-7f5a-9b6c-7d8e9f0a1b2c",
"at": "2026-11-17T08:34:10Z",
"kind": "assigned",
"actor": "user:019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"resolution": "actioned",
"note": null,
"occurrence": null
}إعادة فتح تنبيه مغلق.
POST/v1/alarms/{alarmId}/reopen
Puts a closed alarm back to open, unassigned and unacknowledged; its activity keeps what happened before. Any other status answers 409.
النطاقrules:write
المعاملات
alarmIdstringالمسار مطلوبمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b
الاستجابة 200
idstringمثال:
019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1brule_idstring | nullThe rule that opened the alarm; null once the rule is deleted.
مثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0avehicle_idstringمثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9dkindstringThe template id of the rule that opened the alarm, or custom.
مثال:
overspeedseveritystringأحد:
infowarningcriticalstatusstringopen, then acked (optional), then closed.
أحد:
openackedclosedopened_atstring (date-time)مثال:
2026-11-17T08:30:00Zlast_seen_atstring (date-time)The latest occurrence: a repeat within the rule's minimum gap joins the open alarm.
مثال:
2026-11-17T08:41:00Zoccurrencesintegerمثال:
2assigneestring | nullThe account user the alarm is given to.
مثال:
019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7backed_bystring | nullWho acknowledged it: user:<id> or user:apikey/<key id>.
مثال:
user:apikey/k7Qm2Lp9Xa4Racked_atstring | null (date-time)مثال:
2026-11-17T08:34:10Zclosed_bystring | nullWho closed it (system: when the platform closed it as the condition cleared).
مثال:
nullclosed_atstring | null (date-time)مثال:
nullresolutionstring | nullHow a person closed it; null until then, and when the platform closed it.
notestring | nullThe latest note given when acknowledging or closing.
مثال:
Driver called; speed back to limit.positionobject | nullWhere the vehicle was when it opened.
limitnumber | nullThe limit a condition compared with.
مثال:
120factsobject[]The facts that held when it opened.
حقول facts
factstringA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhnumbernumberمثال:
134textstringمثال:
openbooleanbooleanمثال:
true
الأخطاء
curl -X POST "https://api.ping.nml.sa/v1/alarms/019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b/reopen" \
-H "Authorization: Bearer $PING_API_KEY"{
"id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
"rule_id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"vehicle_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"kind": "overspeed",
"severity": "warning",
"status": "acked",
"opened_at": "2026-11-17T08:30:00Z",
"last_seen_at": "2026-11-17T08:41:00Z",
"occurrences": 2,
"assignee": "019ac0c2-4d9c-7e1f-9a0b-2c3d4e5f6a7b",
"acked_by": "user:apikey/k7Qm2Lp9Xa4R",
"acked_at": "2026-11-17T08:34:10Z",
"closed_by": null,
"closed_at": null,
"resolution": "actioned",
"note": "Driver called; speed back to limit.",
"position": {
"lat": 24.7136,
"lon": 46.6753
},
"limit": 120,
"facts": [
{
"fact": "position.speed_kmh",
"number": 134,
"text": "open",
"boolean": true
}
]
}قائمة قواعد التنبيه.
GET/v1/rules
The account's alert rules, oldest first. A department-scoped key sees only the rules on its own vehicles.
النطاقrules:read
المعاملات
limitintegerالاستعلامItems per page, 1 to 200 (default 50).
cursorstringالاستعلامThe next_cursor of the previous page.
templatestringالاستعلامOnly rules made from this template; custom for custom rules.
مثال:
overspeedenabledbooleanالاستعلامOnly enabled (true) or disabled (false) rules.
geofence_idstringالاستعلامOnly the rules scoped to this geofence.
مثال:
019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c
الاستجابة 200
dataobject[]حقول data
idstringمثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0anamestring | nullمثال:
Highway overspeedtemplatestring | nullThe built-in template the rule is made from; null for a custom rule.
مثال:
overspeedoverridesobject | nullA template rule's overrides; null for a custom rule.
definitionobject | nullA custom rule's definition; null for a template rule.
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
أحد:
customergroupvehiclegeofencescope_idstring | nullThe department (group), vehicle or geofence id; null for the whole account.
مثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleanمثال:
truecreated_atstring (date-time)مثال:
2026-11-17T08:30:00Zupdated_atstring (date-time)مثال:
2026-11-17T08:30:00Z
next_cursorstring | nullمثال:
eyJpZCI6InZlaF83S3EyIn0
الأخطاء
curl "https://api.ping.nml.sa/v1/rules" \
-H "Authorization: Bearer $PING_API_KEY"{
"data": [
{
"id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"name": "Highway overspeed",
"template": "overspeed",
"overrides": {
"params": [
{}
],
"hold_s": 60,
"min_gap_s": 900,
"severity": "warning",
"actions": [
"alarm"
],
"duty": "safety"
},
"definition": {
"when": [
{}
],
"limit": [
{}
],
"schedule": {
"mode": "outside",
"hours": {}
},
"hold_s": 30,
"min_gap_s": 600,
"severity": "warning",
"actions": [
"alarm",
"notify"
],
"duty": "safety",
"late": "notify"
},
"scope_kind": "vehicle",
"scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"enabled": true,
"created_at": "2026-11-17T08:30:00Z",
"updated_at": "2026-11-17T08:30:00Z"
}
],
"next_cursor": "eyJpZCI6InZlaF83S3EyIn0"
}إنشاء قاعدة تنبيه.
POST/v1/rules
A rule from a built-in template with optional overrides (its parameters typed by the template's catalog), or a custom declarative definition, applied to the whole account, a department (group), one vehicle or one geofence. Give template or definition, not both. A department-scoped key creates rules only on its own vehicles.
النطاقrules:write يقبل Idempotency-Key
المعاملات
Idempotency-KeystringالترويسةA unique key per create request. A retry with the same key within 24 hours returns the first result instead of creating again.
محتوى الطلب
namestringمثال:
Highway overspeedtemplatestringA built-in template id. Give template or definition.
مثال:
overspeedoverridesobjectChanges to a template's defaults. Omitted fields keep the template's values.
حقول overrides
paramsobject[]Values for the template's parameters, one per name.
حقول params
namestringمطلوبمثال:
limit_kmhnumbernumberمثال:
100hoursobjectDays and hours in a time zone: from from_day to to_day (across the week's end when to_day comes first), from start to end each day (end 24:00 is midnight).
حقول hours
from_daystringمطلوبأحد:
sunmontuewedthufrisatto_daystringمطلوبأحد:
sunmontuewedthufrisatstartstringمطلوبمثال:
07:00endstringمطلوبمثال:
18:00time_zonestringمطلوبAn IANA time zone.
مثال:
Asia/Riyadh
hold_sintegerSeconds the conditions must hold before the rule fires.
مثال:
60min_gap_sintegerMinimum seconds between two firings on the same vehicle.
مثال:
900severitystringأحد:
infowarningcriticalactionsstring[]مثال:
["alarm"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
أحد:
dispatchworkshopfuelcold_chaincompliancesafety
definitionobjectA custom rule: declarative, no scripting. It fires on the rising edge per vehicle once the conditions hold for hold_s, at most once per min_gap_s per vehicle.
حقول definition
whenobject[]مطلوبحقول when
factstringمطلوبA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhopstringمطلوبchanged: the value differs from the previous record. drop: the value fell by at least number within window_s.
أحد:
=!=>>=<<=changeddropnumbernumberCompare with this number.
مثال:
100textstringCompare with this text (= and != only).
مثال:
openbooleanbooleanCompare with this boolean (= and != only).
مثال:
truelimitbooleanCompare with the rule's limit.
أحد:
truewindow_sintegerSeconds over which drop is measured; only for drop.
مثال:
900
limitobject[]The threshold a condition with limit true compares with: the first term that has a value. Required when a condition uses it.
حقول limit
factstringمثال:
vehicle.speed_limit_kmhnumbernumberمثال:
100paramstringمثال:
limit_kmh
scheduleobjectWhen a custom rule applies: inside or outside the hours, or (hours null) the account's operating calendar: its operating week and hours (accounts), Ramadan's hours and the Kingdom's holidays (closed).
حقول schedule
modestringمطلوبأحد:
insideoutsidehoursobject | nullمطلوب
hold_sintegerمطلوبSeconds the conditions must hold before the rule fires.
مثال:
30min_gap_sintegerمطلوبMinimum seconds between two firings on the same vehicle.
مثال:
600severitystringمطلوبأحد:
infowarningcriticalactionsstring[]مطلوبمثال:
["alarm","notify"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
أحد:
dispatchworkshopfuelcold_chaincompliancesafetylatestringCritical rules only: still notify on records that arrive late (buffered while out of coverage), marked delayed.
أحد:
notify
scope_kindstringمطلوبWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
أحد:
customergroupvehiclegeofencescope_idstringThe department (group), vehicle or geofence id; required for group, vehicle and geofence, omitted for customer.
مثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleanمثال:
true
الاستجابة 201
idstringمثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0anamestring | nullمثال:
Highway overspeedtemplatestring | nullThe built-in template the rule is made from; null for a custom rule.
مثال:
overspeedoverridesobject | nullA template rule's overrides; null for a custom rule.
definitionobject | nullA custom rule's definition; null for a template rule.
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
أحد:
customergroupvehiclegeofencescope_idstring | nullThe department (group), vehicle or geofence id; null for the whole account.
مثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleanمثال:
truecreated_atstring (date-time)مثال:
2026-11-17T08:30:00Zupdated_atstring (date-time)مثال:
2026-11-17T08:30:00Z
الأخطاء
curl -X POST "https://api.ping.nml.sa/v1/rules" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Highway overspeed", "template": "overspeed", "scope_kind": "vehicle", "scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d", "enabled": true}'{
"id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"name": "Highway overspeed",
"template": "overspeed",
"overrides": {
"params": [
{
"name": "limit_kmh",
"number": 100,
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
}
],
"hold_s": 60,
"min_gap_s": 900,
"severity": "warning",
"actions": [
"alarm"
],
"duty": "safety"
},
"definition": {
"when": [
{
"fact": "position.speed_kmh",
"op": ">",
"number": 100,
"text": "open",
"boolean": true,
"limit": true,
"window_s": 900
}
],
"limit": [
{
"fact": "vehicle.speed_limit_kmh",
"number": 100,
"param": "limit_kmh"
}
],
"schedule": {
"mode": "outside",
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
},
"hold_s": 30,
"min_gap_s": 600,
"severity": "warning",
"actions": [
"alarm",
"notify"
],
"duty": "safety",
"late": "notify"
},
"scope_kind": "vehicle",
"scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"enabled": true,
"created_at": "2026-11-17T08:30:00Z",
"updated_at": "2026-11-17T08:30:00Z"
}تعديل قاعدة تنبيه.
PATCH/v1/rules/{ruleId}
Changes the fields given and keeps the rest. overrides applies to template rules and definition to custom rules; each replaces the stored value whole. An empty name clears the name; scope_kind and scope_id change together.
النطاقrules:write
المعاملات
ruleIdstringالمسار مطلوبمثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a
محتوى الطلب
namestringAn empty name clears it.
مثال:
Highway overspeedoverridesobjectChanges to a template's defaults. Omitted fields keep the template's values.
حقول overrides
paramsobject[]Values for the template's parameters, one per name.
حقول params
namestringمطلوبمثال:
limit_kmhnumbernumberمثال:
100hoursobjectDays and hours in a time zone: from from_day to to_day (across the week's end when to_day comes first), from start to end each day (end 24:00 is midnight).
حقول hours
from_daystringمطلوبأحد:
sunmontuewedthufrisatto_daystringمطلوبأحد:
sunmontuewedthufrisatstartstringمطلوبمثال:
07:00endstringمطلوبمثال:
18:00time_zonestringمطلوبAn IANA time zone.
مثال:
Asia/Riyadh
hold_sintegerSeconds the conditions must hold before the rule fires.
مثال:
60min_gap_sintegerMinimum seconds between two firings on the same vehicle.
مثال:
900severitystringأحد:
infowarningcriticalactionsstring[]مثال:
["alarm"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
أحد:
dispatchworkshopfuelcold_chaincompliancesafety
definitionobjectA custom rule: declarative, no scripting. It fires on the rising edge per vehicle once the conditions hold for hold_s, at most once per min_gap_s per vehicle.
حقول definition
whenobject[]مطلوبحقول when
factstringمطلوبA namespaced fact: position.* (the latest record; position.priority the highest record priority, 2 = panic), state.* (device state), signal.<key> (one measurement whichever model reports it: a device IO element is read as the signal it maps to in infra/devices/io/signals.toml), geofence.*, vehicle.*, alarm.*, rider.* (rider.onboard, rider.unknown_card) or cargo.* (cargo.warmest_c, cargo.coldest_c: the compartment's probes).
مثال:
position.speed_kmhopstringمطلوبchanged: the value differs from the previous record. drop: the value fell by at least number within window_s.
أحد:
=!=>>=<<=changeddropnumbernumberCompare with this number.
مثال:
100textstringCompare with this text (= and != only).
مثال:
openbooleanbooleanCompare with this boolean (= and != only).
مثال:
truelimitbooleanCompare with the rule's limit.
أحد:
truewindow_sintegerSeconds over which drop is measured; only for drop.
مثال:
900
limitobject[]The threshold a condition with limit true compares with: the first term that has a value. Required when a condition uses it.
حقول limit
factstringمثال:
vehicle.speed_limit_kmhnumbernumberمثال:
100paramstringمثال:
limit_kmh
scheduleobjectWhen a custom rule applies: inside or outside the hours, or (hours null) the account's operating calendar: its operating week and hours (accounts), Ramadan's hours and the Kingdom's holidays (closed).
حقول schedule
modestringمطلوبأحد:
insideoutsidehoursobject | nullمطلوب
hold_sintegerمطلوبSeconds the conditions must hold before the rule fires.
مثال:
30min_gap_sintegerمطلوبMinimum seconds between two firings on the same vehicle.
مثال:
600severitystringمطلوبأحد:
infowarningcriticalactionsstring[]مطلوبمثال:
["alarm","notify"]dutystringnotify goes to the account's users holding this duty (accounts users' duties); a template rule takes its template's unless overridden.
أحد:
dispatchworkshopfuelcold_chaincompliancesafetylatestringCritical rules only: still notify on records that arrive late (buffered while out of coverage), marked delayed.
أحد:
notify
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
أحد:
customergroupvehiclegeofencescope_idstringGive with scope_kind (omitted for customer).
مثال:
019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8cenabledbooleanمثال:
false
الاستجابة 200
idstringمثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0anamestring | nullمثال:
Highway overspeedtemplatestring | nullThe built-in template the rule is made from; null for a custom rule.
مثال:
overspeedoverridesobject | nullA template rule's overrides; null for a custom rule.
definitionobject | nullA custom rule's definition; null for a template rule.
scope_kindstringWhat the rule applies to: the whole account, a group (an accounts department and the departments under it, by the vehicle's department in fleet), one vehicle, or every vehicle in one geofence (its geofence.* facts are that geofence's).
أحد:
customergroupvehiclegeofencescope_idstring | nullThe department (group), vehicle or geofence id; null for the whole account.
مثال:
019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9denabledbooleanمثال:
truecreated_atstring (date-time)مثال:
2026-11-17T08:30:00Zupdated_atstring (date-time)مثال:
2026-11-17T08:30:00Z
الأخطاء
curl -X PATCH "https://api.ping.nml.sa/v1/rules/019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a" \
-H "Authorization: Bearer $PING_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Highway overspeed", "scope_kind": "vehicle", "scope_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c", "enabled": false}'{
"id": "019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
"name": "Highway overspeed",
"template": "overspeed",
"overrides": {
"params": [
{
"name": "limit_kmh",
"number": 100,
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
}
],
"hold_s": 60,
"min_gap_s": 900,
"severity": "warning",
"actions": [
"alarm"
],
"duty": "safety"
},
"definition": {
"when": [
{
"fact": "position.speed_kmh",
"op": ">",
"number": 100,
"text": "open",
"boolean": true,
"limit": true,
"window_s": 900
}
],
"limit": [
{
"fact": "vehicle.speed_limit_kmh",
"number": 100,
"param": "limit_kmh"
}
],
"schedule": {
"mode": "outside",
"hours": {
"from_day": "sun",
"to_day": "sun",
"start": "07:00",
"end": "18:00",
"time_zone": "Asia/Riyadh"
}
},
"hold_s": 30,
"min_gap_s": 600,
"severity": "warning",
"actions": [
"alarm",
"notify"
],
"duty": "safety",
"late": "notify"
},
"scope_kind": "vehicle",
"scope_id": "019ac0c4-6f1e-7a3b-9c2d-4e5f6a7b8c9d",
"enabled": true,
"created_at": "2026-11-17T08:30:00Z",
"updated_at": "2026-11-17T08:30:00Z"
}حذف قاعدة تنبيه.
DELETE/v1/rules/{ruleId}
The rule stops evaluating. Alarms it opened remain, with rule_id set to null.
النطاقrules:write
المعاملات
ruleIdstringالمسار مطلوبمثال:
019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a
الاستجابة 204
Deleted.
الأخطاء
curl -X DELETE "https://api.ping.nml.sa/v1/rules/019ac0c5-1b2c-7d3e-8f4a-5b6c7d8e9f0a" \
-H "Authorization: Bearer $PING_API_KEY"