كل الموارد

الويب هوك

نقاط استقبال الأحداث الموقّعة: التنبيهات والرحلات والمناطق والمهام، مع سجل التسليم وإعادة الإرسال.

عنوان الأساسhttps://api.ping.nml.sa/v110 عمليات

الانتقال إلى عملية

الأخطاء المشتركة

تُرجع عمليات هذه الصفحة هذه الأخطاء بصيغة واحدة، وتذكر كل عملية الأخطاء التي تُرجعها.

  • 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/webhook-deliveries

Deliveries are kept 30 days.

النطاقwebhooks:read

المعاملات

  • endpoint_idstring الاستعلام

    One endpoint's deliveries.

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • statestring الاستعلام

    Only deliveries in this state.

    مثال:succeeded

  • typestring الاستعلام

    Only deliveries of this event type.

    مثال:trip.ended

  • limitinteger الاستعلام

    Items per page, 1 to 200 (default 50).

  • cursorstring الاستعلام

    The next_cursor of the previous page.

الاستجابة 200

  • dataobject[]
    حقول data
    • idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • endpoint_idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • event_idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • typestring

      A delivered event's type: a WebhookEventType, or webhook.test.

      أحد:alarm.openedalarm.clearedtrip.endedgeofence.enteredgeofence.exitedjob.dispatchedjob.startedjob.completedjob.cancelledwebhook.test

    • redelivery_ofstring | null

      The delivery this one sends again.

    • statestring

      أحد:pendingsucceededfailed

    • failurestring | null

      Why it failed: every attempt failed, or the endpoint was disabled first.

      أحد:exhaustedendpoint_disablednull

    • attemptsinteger
    • next_attempt_atstring | null (date-time)

      When it is tried next (pending only).

    • created_atstring (date-time)
    • done_atstring | null (date-time)
  • next_cursorstring | null

الأخطاء

400401403429

مثال الطلب
curl "https://api.ping.nml.sa/v1/webhook-deliveries" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "data": [
    {
      "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
      "endpoint_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
      "event_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
      "type": "trip.ended",
      "redelivery_of": "string",
      "state": "succeeded",
      "failure": "exhausted",
      "attempts": 0,
      "next_attempt_at": "string",
      "created_at": "string",
      "done_at": "string"
    }
  ],
  "next_cursor": "string"
}

تسليم ويب هوك مع محاولاته.

GET/v1/webhook-deliveries/{deliveryId}

النطاقwebhooks:read

المعاملات

  • deliveryIdstring المسار مطلوب

    مثال:019ac0d2-3c4d-7e5f-8a6b-7c8d9e0f1a2b

الاستجابة 200

  • deliveryobject
    حقول delivery
    • idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • endpoint_idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • event_idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • typestring

      A delivered event's type: a WebhookEventType, or webhook.test.

      أحد:alarm.openedalarm.clearedtrip.endedgeofence.enteredgeofence.exitedjob.dispatchedjob.startedjob.completedjob.cancelledwebhook.test

    • redelivery_ofstring | null

      The delivery this one sends again.

    • statestring

      أحد:pendingsucceededfailed

    • failurestring | null

      Why it failed: every attempt failed, or the endpoint was disabled first.

      أحد:exhaustedendpoint_disablednull

    • attemptsinteger
    • next_attempt_atstring | null (date-time)

      When it is tried next (pending only).

    • created_atstring (date-time)
    • done_atstring | null (date-time)
  • payloadalarm.opened | alarm.cleared | trip.ended | geofence.entered | geofence.exited | job.dispatched | job.started | job.completed | job.cancelled | webhook.test

    One webhook body: the payload of its type.

  • attempt_logobject[]

    Every attempt, first first.

    حقول attempt_log
    • ninteger
    • atstring (date-time)
    • urlstring

      The URL it went to (the endpoint's at the time).

    • addressstring | null

      The address dialled.

      مثال:203.0.113.7

    • outcomestring

      delivered: 2xx; http_error: another status (redirects are not followed); unreachable: DNS, connection or TLS; refused_address: the host resolved to a non-public address.

      أحد:deliveredhttp_errortimeoutunreachablerefused_address

    • statusinteger | null
    • duration_msinteger
    • errorstring | null

      What went wrong, for people.

الأخطاء

400401403404429

مثال الطلب
curl "https://api.ping.nml.sa/v1/webhook-deliveries/019ac0d2-3c4d-7e5f-8a6b-7c8d9e0f1a2b" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "delivery": {
    "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
    "endpoint_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
    "event_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
    "type": "trip.ended",
    "redelivery_of": "string",
    "state": "succeeded",
    "failure": "exhausted",
    "attempts": 0,
    "next_attempt_at": "string",
    "created_at": "string",
    "done_at": "string"
  },
  "payload": {
    "id": "019ac0d1-7a2b-7c3d-8e4f-5a6b7c8d9e0f",
    "type": "alarm.opened",
    "occurred_at": "2026-11-17T08:30:00Z",
    "data": {
      "alarm_id": "019ac0c6-2c3d-7e4f-8a5b-6c7d8e9f0a1b",
      "rule_id": "string",
      "vehicle_id": "string",
      "kind": "overspeed",
      "severity": "info",
      "opened_at": "string",
      "lat": 24.7136,
      "lon": 46.6753
    }
  },
  "attempt_log": [
    {
      "n": 0,
      "at": "string",
      "url": "string",
      "address": "203.0.113.7",
      "outcome": "delivered",
      "status": 0,
      "duration_ms": 0,
      "error": "string"
    }
  ]
}

إعادة إرسال حدث ويب هوك.

POST/v1/webhook-deliveries/{deliveryId}/redeliver

Only a delivery that succeeded or failed, to an enabled endpoint (else 409).

النطاقwebhooks:write

المعاملات

  • deliveryIdstring المسار مطلوب

    مثال:019ac0d2-3c4d-7e5f-8a6b-7c8d9e0f1a2b

الاستجابة 202

  • idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • endpoint_idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • event_idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • typestring

    A delivered event's type: a WebhookEventType, or webhook.test.

    أحد:alarm.openedalarm.clearedtrip.endedgeofence.enteredgeofence.exitedjob.dispatchedjob.startedjob.completedjob.cancelledwebhook.test

  • redelivery_ofstring | null

    The delivery this one sends again.

  • statestring

    أحد:pendingsucceededfailed

  • failurestring | null

    Why it failed: every attempt failed, or the endpoint was disabled first.

    أحد:exhaustedendpoint_disablednull

  • attemptsinteger
  • next_attempt_atstring | null (date-time)

    When it is tried next (pending only).

  • created_atstring (date-time)
  • done_atstring | null (date-time)

الأخطاء

400401403404409429

مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/webhook-deliveries/019ac0d2-3c4d-7e5f-8a6b-7c8d9e0f1a2b/redeliver" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 202
{
  "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "endpoint_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "event_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "type": "trip.ended",
  "redelivery_of": "string",
  "state": "succeeded",
  "failure": "exhausted",
  "attempts": 0,
  "next_attempt_at": "string",
  "created_at": "string",
  "done_at": "string"
}

قائمة نقاط استقبال الويب هوك.

GET/v1/webhook-endpoints

النطاقwebhooks:read

المعاملات

  • limitinteger الاستعلام

    Items per page, 1 to 200 (default 50).

  • cursorstring الاستعلام

    The next_cursor of the previous page.

الاستجابة 200

  • dataobject[]
    حقول data
    • idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • urlstring

      مثال:https://erp.example.com/ping/webhooks

    • descriptionstring | null

      مثال:ERP alarms feed

    • event_typesstring[]
    • enabledboolean
    • disabled_reasonstring | null

      owner: turned off by a person; failing: disabled after repeated failure; account_ended: the account left PING (its exit).

      أحد:ownerfailingaccount_endednull

    • disabled_atstring | null (date-time)
    • secret_hintstring

      The secret's last four characters.

      مثال:x7Qa

    • secret_rotated_atstring (date-time)
    • consecutive_failuresinteger

      Deliveries in a row that failed for good.

    • created_atstring (date-time)
    • updated_atstring (date-time)
  • next_cursorstring | null

الأخطاء

400401403429

مثال الطلب
curl "https://api.ping.nml.sa/v1/webhook-endpoints" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "data": [
    {
      "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
      "url": "https://erp.example.com/ping/webhooks",
      "description": "ERP alarms feed",
      "event_types": [
        "alarm.opened"
      ],
      "enabled": false,
      "disabled_reason": "owner",
      "disabled_at": "string",
      "secret_hint": "x7Qa",
      "secret_rotated_at": "string",
      "consecutive_failures": 0,
      "created_at": "string",
      "updated_at": "string"
    }
  ],
  "next_cursor": "string"
}

إضافة نقطة استقبال ويب هوك؛ يظهر سر التوقيع مرة واحدة.

POST/v1/webhook-endpoints

The URL must be https and its host a name or a public address (private, loopback, link-local and reserved addresses are refused, and checked again on every delivery). At most 10 endpoints per account.

النطاقwebhooks: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.

محتوى الطلب

  • urlstring مطلوب

    https only; no credentials, no private, loopback or link-local address.

    مثال:https://erp.example.com/ping/webhooks

  • descriptionstring

    مثال:ERP alarms feed

  • event_typesstring[] مطلوب

    مثال:["alarm.opened","alarm.cleared"]

  • enabledboolean

الاستجابة 201

  • endpointobject
    حقول endpoint
    • idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • urlstring

      مثال:https://erp.example.com/ping/webhooks

    • descriptionstring | null

      مثال:ERP alarms feed

    • event_typesstring[]
    • enabledboolean
    • disabled_reasonstring | null

      owner: turned off by a person; failing: disabled after repeated failure; account_ended: the account left PING (its exit).

      أحد:ownerfailingaccount_endednull

    • disabled_atstring | null (date-time)
    • secret_hintstring

      The secret's last four characters.

      مثال:x7Qa

    • secret_rotated_atstring (date-time)
    • consecutive_failuresinteger

      Deliveries in a row that failed for good.

    • created_atstring (date-time)
    • updated_atstring (date-time)
  • secretstring

    The signing secret, shown only in this answer.

    مثال:whsec_4fJ9kQ2mX7pL1sV8nR3tY6wZ0aB5cD7x

الأخطاء

400401403409429

مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/webhook-endpoints" \
  -H "Authorization: Bearer $PING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://erp.example.com/ping/webhooks", "description": "ERP alarms feed", "event_types": ["alarm.opened", "alarm.cleared"]}'
مثال الاستجابة · 201
{
  "endpoint": {
    "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
    "url": "https://erp.example.com/ping/webhooks",
    "description": "ERP alarms feed",
    "event_types": [
      "alarm.opened"
    ],
    "enabled": false,
    "disabled_reason": "owner",
    "disabled_at": "string",
    "secret_hint": "x7Qa",
    "secret_rotated_at": "string",
    "consecutive_failures": 0,
    "created_at": "string",
    "updated_at": "string"
  },
  "secret": "whsec_4fJ9kQ2mX7pL1sV8nR3tY6wZ0aB5cD7x"
}

نقطة استقبال ويب هوك.

GET/v1/webhook-endpoints/{endpointId}

النطاقwebhooks:read

المعاملات

  • endpointIdstring المسار مطلوب

    مثال:019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f

الاستجابة 200

  • idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • urlstring

    مثال:https://erp.example.com/ping/webhooks

  • descriptionstring | null

    مثال:ERP alarms feed

  • event_typesstring[]
  • enabledboolean
  • disabled_reasonstring | null

    owner: turned off by a person; failing: disabled after repeated failure; account_ended: the account left PING (its exit).

    أحد:ownerfailingaccount_endednull

  • disabled_atstring | null (date-time)
  • secret_hintstring

    The secret's last four characters.

    مثال:x7Qa

  • secret_rotated_atstring (date-time)
  • consecutive_failuresinteger

    Deliveries in a row that failed for good.

  • created_atstring (date-time)
  • updated_atstring (date-time)

الأخطاء

400401403404429

مثال الطلب
curl "https://api.ping.nml.sa/v1/webhook-endpoints/019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "url": "https://erp.example.com/ping/webhooks",
  "description": "ERP alarms feed",
  "event_types": [
    "alarm.opened"
  ],
  "enabled": false,
  "disabled_reason": "owner",
  "disabled_at": "string",
  "secret_hint": "x7Qa",
  "secret_rotated_at": "string",
  "consecutive_failures": 0,
  "created_at": "string",
  "updated_at": "string"
}

تعديل نقطة استقبال ويب هوك.

PATCH/v1/webhook-endpoints/{endpointId}

Fields given replace the stored ones; event_types replaces the list whole. enabled false stops deliveries (pending ones fail as endpoint_disabled); enabled true turns a disabled endpoint back on and clears its failure count.

النطاقwebhooks:write

المعاملات

  • endpointIdstring المسار مطلوب

    مثال:019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f

محتوى الطلب

  • urlstring

    مثال:https://erp.example.com/ping/webhooks

  • descriptionstring

    An empty description clears it.

  • event_typesstring[]
  • enabledboolean

الاستجابة 200

  • idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • urlstring

    مثال:https://erp.example.com/ping/webhooks

  • descriptionstring | null

    مثال:ERP alarms feed

  • event_typesstring[]
  • enabledboolean
  • disabled_reasonstring | null

    owner: turned off by a person; failing: disabled after repeated failure; account_ended: the account left PING (its exit).

    أحد:ownerfailingaccount_endednull

  • disabled_atstring | null (date-time)
  • secret_hintstring

    The secret's last four characters.

    مثال:x7Qa

  • secret_rotated_atstring (date-time)
  • consecutive_failuresinteger

    Deliveries in a row that failed for good.

  • created_atstring (date-time)
  • updated_atstring (date-time)

الأخطاء

400401403404429

مثال الطلب
curl -X PATCH "https://api.ping.nml.sa/v1/webhook-endpoints/019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f" \
  -H "Authorization: Bearer $PING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://erp.example.com/ping/webhooks"}'
مثال الاستجابة · 200
{
  "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "url": "https://erp.example.com/ping/webhooks",
  "description": "ERP alarms feed",
  "event_types": [
    "alarm.opened"
  ],
  "enabled": false,
  "disabled_reason": "owner",
  "disabled_at": "string",
  "secret_hint": "x7Qa",
  "secret_rotated_at": "string",
  "consecutive_failures": 0,
  "created_at": "string",
  "updated_at": "string"
}

حذف نقطة استقبال ويب هوك.

DELETE/v1/webhook-endpoints/{endpointId}

النطاقwebhooks:write

المعاملات

  • endpointIdstring المسار مطلوب

    مثال:019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f

الاستجابة 204

Removed.

الأخطاء

400401403404429

مثال الطلب
curl -X DELETE "https://api.ping.nml.sa/v1/webhook-endpoints/019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f" \
  -H "Authorization: Bearer $PING_API_KEY"

تجديد سر توقيع نقطة استقبال الويب هوك.

POST/v1/webhook-endpoints/{endpointId}/rotate-secret

النطاقwebhooks:write

المعاملات

  • endpointIdstring المسار مطلوب

    مثال:019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f

الاستجابة 200

  • endpointobject
    حقول endpoint
    • idstring

      مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

    • urlstring

      مثال:https://erp.example.com/ping/webhooks

    • descriptionstring | null

      مثال:ERP alarms feed

    • event_typesstring[]
    • enabledboolean
    • disabled_reasonstring | null

      owner: turned off by a person; failing: disabled after repeated failure; account_ended: the account left PING (its exit).

      أحد:ownerfailingaccount_endednull

    • disabled_atstring | null (date-time)
    • secret_hintstring

      The secret's last four characters.

      مثال:x7Qa

    • secret_rotated_atstring (date-time)
    • consecutive_failuresinteger

      Deliveries in a row that failed for good.

    • created_atstring (date-time)
    • updated_atstring (date-time)
  • secretstring

    The signing secret, shown only in this answer.

    مثال:whsec_4fJ9kQ2mX7pL1sV8nR3tY6wZ0aB5cD7x

الأخطاء

400401403404409429

مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/webhook-endpoints/019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f/rotate-secret" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 200
{
  "endpoint": {
    "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
    "url": "https://erp.example.com/ping/webhooks",
    "description": "ERP alarms feed",
    "event_types": [
      "alarm.opened"
    ],
    "enabled": false,
    "disabled_reason": "owner",
    "disabled_at": "string",
    "secret_hint": "x7Qa",
    "secret_rotated_at": "string",
    "consecutive_failures": 0,
    "created_at": "string",
    "updated_at": "string"
  },
  "secret": "whsec_4fJ9kQ2mX7pL1sV8nR3tY6wZ0aB5cD7x"
}

إرسال حدث تجريبي إلى نقطة استقبال الويب هوك.

POST/v1/webhook-endpoints/{endpointId}/test

النطاقwebhooks:write

المعاملات

  • endpointIdstring المسار مطلوب

    مثال:019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f

الاستجابة 202

  • idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • endpoint_idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • event_idstring

    مثال:019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c

  • typestring

    A delivered event's type: a WebhookEventType, or webhook.test.

    أحد:alarm.openedalarm.clearedtrip.endedgeofence.enteredgeofence.exitedjob.dispatchedjob.startedjob.completedjob.cancelledwebhook.test

  • redelivery_ofstring | null

    The delivery this one sends again.

  • statestring

    أحد:pendingsucceededfailed

  • failurestring | null

    Why it failed: every attempt failed, or the endpoint was disabled first.

    أحد:exhaustedendpoint_disablednull

  • attemptsinteger
  • next_attempt_atstring | null (date-time)

    When it is tried next (pending only).

  • created_atstring (date-time)
  • done_atstring | null (date-time)

الأخطاء

400401403404409429

مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/webhook-endpoints/019ac0d0-1a2b-7c3d-8e4f-5a6b7c8d9e0f/test" \
  -H "Authorization: Bearer $PING_API_KEY"
مثال الاستجابة · 202
{
  "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "endpoint_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "event_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "type": "trip.ended",
  "redelivery_of": "string",
  "state": "succeeded",
  "failure": "exhausted",
  "attempts": 0,
  "next_attempt_at": "string",
  "created_at": "string",
  "done_at": "string"
}