كل الموارد

التقارير

إنشاء تقارير الأسطول بصيغتي PDF وExcel وإرسالها بالبريد الإلكتروني أو واتساب.

عنوان الأساسhttps://api.ping.nml.sa/v1عملية واحدة

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

إرسال تقرير الأسطول.

POST/v1/reports

Queues a fleet summary, trips, alarms or daily statistics report for a period, rendered as PDF or Excel and sent by email or WhatsApp to the recipients given. The response is the queued request; rendering and delivery follow asynchronously.

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

محتوى الطلب

  • kindstring مطلوب

    fleet_summary: totals and distance per day and per vehicle; trips: each trip with its stops; alarms: alarms raised and how they were handled; daily_stats: distance, driving and idle hours per vehicle per day.

    أحد:fleet_summarytripsalarmsdaily_stats

  • periodobject مطلوب

    Calendar days in Asia/Riyadh, both inclusive. At most 366 days, within the last five years, and not after today.

    حقول period
    • fromstring (date) مطلوب

      مثال:2026-11-09

    • tostring (date) مطلوب

      مثال:2026-11-15

  • vehicle_idsstring[]

    Vehicles to include. With neither vehicle_ids nor group_ids, every vehicle the key can see.

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

  • group_idsstring[]

    Groups whose vehicles to include, limited to the vehicles the key can see.

    مثال:["019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8d"]

  • formatstring

    pdf, or xlsx for Excel.

    أحد:pdfxlsx

  • languagestring

    أحد:aren

  • recipientsobject[] مطلوب

    مثال:[{"email":"operations@example.com.sa"},{"contact_id":"019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c"}]

    حقول recipients
    • emailstring

      Email address

      مثال:fahad@example.com

    • contact_idstring

      A contact of the account (accounts API).

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

الاستجابة 202

  • idstring

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

  • kindstring

    fleet_summary: totals and distance per day and per vehicle; trips: each trip with its stops; alarms: alarms raised and how they were handled; daily_stats: distance, driving and idle hours per vehicle per day.

    أحد:fleet_summarytripsalarmsdaily_stats

  • periodobject

    Calendar days in Asia/Riyadh, both inclusive. At most 366 days, within the last five years, and not after today.

    حقول period
    • fromstring (date)

      مثال:2026-11-09

    • tostring (date)

      مثال:2026-11-15

  • vehicle_idsstring[]
  • group_idsstring[]
  • formatstring

    pdf, or xlsx for Excel.

    أحد:pdfxlsx

  • languagestring

    أحد:aren

  • recipientsobject[]
    حقول recipients
    • emailstring

      Email address

      مثال:fahad@example.com

    • contact_idstring

      A contact of the account (accounts API).

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

  • statusstring

    أحد:queuedrenderingsentfailed

  • created_atstring (date-time)

    مثال:2026-11-16T05:30:00Z

الأخطاء

  • 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).
  • 429The key's rate limit is reached (code: rate_limited). Retry after the Retry-After header's seconds.
مثال الطلب
curl -X POST "https://api.ping.nml.sa/v1/reports" \
  -H "Authorization: Bearer $PING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind": "fleet_summary", "period": {"from": "2026-11-09", "to": "2026-11-15"}, "vehicle_ids": ["019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c"], "group_ids": ["019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8d"], "format": "pdf", "recipients": [{"email": "operations@example.com.sa"}, {"contact_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c"}]}'
مثال الاستجابة · 202
{
  "id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c",
  "kind": "fleet_summary",
  "period": {
    "from": "2026-11-09",
    "to": "2026-11-15"
  },
  "vehicle_ids": [
    "string"
  ],
  "group_ids": [
    "string"
  ],
  "format": "pdf",
  "language": "ar",
  "recipients": [
    {
      "email": "fahad@example.com",
      "contact_id": "019ac0c3-5e0d-7f2a-8b1c-3d4e5f6a7b8c"
    }
  ],
  "status": "queued",
  "created_at": "2026-11-16T05:30:00Z"
}