API zdarzeń
Wprowadzenie do funkcji
EventAPI to aktywna usługa powiadomień FlightHub Sync służąca do wypychania zdarzeń biznesowych do platform innych firm w czasie rzeczywistym. Podczas korzystania z EventAPI zwróć uwagę na następujące kwestie:
- Użytkownicy muszą zweryfikować pole
x-dji-signaturew nagłówku otrzymanego serwisu. Podpis jest obliczany przy użyciu HMAC-SHA256 na podstawie tokena organizacji, który służy do weryfikacji ważności źródła żądania.
- Użytkownicy muszą zweryfikować pole
- Użytkownicy mogą konfigurować reguły powiadomień, wybierać typy zdarzeń do subskrypcji i określać subskrypcję danych dla wszystkich projektów lub konkretnych projektów.
- Punkt końcowy odbioru obsługuje zarówno protokoły HTTP, jak i HTTPS.
- FlightHub 2 wypchnie powiadomienia o zdarzeniach przy użyciu stałego adresu IP. Serwery w różnych regionach używają różnych adresów IP. W przypadku wersji on-premises FlightHub konkretny adres IP zależy od Twojego serwera.
| Kraj/Region | IP |
|---|---|
| Serwer UE + Serwer globalny | 18.198.174.643.64.50.1133.71.214.1463.177.169.6152.3.45.19952.55.215.24852.73.49.17934.237.190.20634.237.182.4934.228.131.169 |
Konfiguracja reguł powiadomień
Zarządzanie regułami
Lista reguł wyświetla następujące informacje:
- Nazwa reguły: zdefiniowana przez użytkownika, do 60 znaków
- Adres wypychania: adres URL punktu końcowego (HTTP/HTTPS)
- Zakres danych: wszystkie projekty lub konkretne projekty
- Subskrybowane zdarzenia: lista wybranych typów zdarzeń
- Status: włączone/wyłączone
- Akcje: edycja, usuwanie
Konfiguracja zakresu danych
- Wszystkie projekty: automatycznie obejmuje wszystkie przyszłe projekty.
- Konkretne projekty: każdy projekt może być przywołany tylko przez jedną niestandardową regułę (z wyłączeniem reguł "Wszystkie projekty"). Projekty już przywołane zostaną wyszarzone.
Uwaga: jeśli w organizacji istnieje już reguła "Wszystkie projekty", utworzenie nowej reguły dla konkretnych projektów wywoła ostrzeżenie o podwójnym wypchnięciu zdarzeń.
Audyt logów dostarczania
EventAPI udostępnia 7-dniowe statystyki logów dostarczania, w tym:
- Wskaźnik powodzenia: wyświetlany jako procent; wywołanie zwrotne 200 jest uznawane za udane.
- Całkowita liczba zdarzeń: liczba zdarzeń wygenerowanych w ciągu ostatnich 7 dni
- Liczba niepowodzeń: całkowita liczba nieudanych dostaw w ciągu 7 dni
Logi z ostatnich 7 dni można pobrać w formacie CSV. Przechowywane są tylko dane z tego okresu.
Typy wypychanych zdarzeń
Powiadomienie o synchronizacji plików
{
"id": "e3b0c442-73fc-1c14-9afb-f17e2fa6826a", // Universally unique identifier (UUID) for event message
"type": "file_sync_success", // Event type: file synced notification
"created_at": 1767875288, // Event push timestamp (seconds)
"data": {
"task_id": "sync_task_10001", // Universally unique identifier of the sync task
"organization_id": "org_123456_xxxxxx", // organization ID
"project_id": "proj_789012_xxxxxx", // Project ID of file
"file_id": "file_345678_xxxxxx", // File ID within FlightHub
"file_type": "application/pdf", // File type (waypoint route, flight record, model, or media file)
"file_external_key": "customer_storage/2026/01/report_09.pdf", // Object Key (storage path) for file in third-party storage bucket
"file_bytes_size": 1048576, // File size (bytes)
"fh2_file_path": "/project_docs/report/report_09.pdf", // Original logical path of the file in DJI FlightHub 2
}
}
Uzyskanie listy ostrzeżeń AI i migawki
{
"id": "e3b0c442-98fc-1c14-9afb-f17e2fa6826a" , // UUID of the event message
"type": "ai_alert_record", // Event type: AI detection records
"created_at": 1767875288, // Event push timestamp (seconds)
"data": {
"alert_uuid": "e3b0c442-98fc-1c14-9afb-f17e2fa6826a", // UUID of warning records
"algorithm_source": 100002, // // Algorithm source ID Enumeration values are as follows:
// 0: DJI official intelligent algorithm
// 1: DJI visible light detection of people, vehicles, and boats
// 2: DJI infrared detection of people, vehicles, and boats
// 3: DJI infrared temperature detection
// 255: AI-inside third-party algorithms on aircraft
// 100001: AI-LINK third-party cloud algorithms
// 100002: DJI multimodal object detection
"drone_sn": "1581F6XXXXXX00A6XXXX", // Serial number of the aircraft performing task
"file_id": 123456, // Associated original media file ID
"file_url": "https://file-storage.djicdn.com/example/path/image.jpg?auth_key=xxxx", // Original image download link (contains authentication parameters)
"flight_id": "f17e2fa6-826a-48c5-a89a-fffe4093xxxx", // Associated flight ID
"gateway_sn": "6QCDL8XXXXXX02XXXX", // Associated dock/gateway device SN
"interval_seconds": 0, // Alert interval or duration (seconds). Defaults to 0 for non-cloud algorithms
"labels": [
"lights"// Detected subject label/type
],
"location": {
"altitude": 80.5, // The altitude when the alert occurred (meters)
"latitude": 22.123456, // The latitude when the alert occurred. For on-board algorithms, this is the GPS coordinate of the center of the camera view when the alert occurred. For cloud algorithms, this is the position of the aircraft.
"longitude": 113.123456, // The longitude when the alert occurred. For on-board algorithms, this is the GPS coordinate of the center of the camera view when the alert occurred. For cloud algorithms, this is the position of the aircraft.
},
"project_id": "fe2400a5-5a74-4cb5-8374-548b7eaxxxxx", // Affiliated project UUID
"task_name": "FlyToTask_Inspect_ZoneA", // Associated flight task name
"thumbnail_url": "https://oss-cn-hangzhou.aliyuncs.com/example/thumbnail.jpeg?Expires=1767961676&Signature=xxxx", // Thumbnail download link (includes signature and expiration date)
"timestamp": 1767875275677, // The timestamp when AI detection occurred (milliseconds)
}
}
Powiadomienie o postępie wyzwalanego przepływu pracy
Służy do wypychania postępu wykonywania węzłów przepływu pracy automatycznego wysyłania (przepływu pracy reagowania na incydenty), umożliwiając systemom innych firm synchronizację statusu zadań, identyfikację stanów końcowych i oznaczeń fałszywych alarmów w czasie rzeczywistym.
{
"event_type": "alert_workflow_progress", // Event type: triggered workflow execution progress
"event_id": "e3b0c442-73fc-1c14-9afb-f17e2fa6826a", // Unique event message ID (UUID)
"org_id": "org_123456_xxxxxx", // Organization ID this event belongs to
"project_id": "proj_789012_xxxxxx", // Project ID this event belongs to (optional)
"created_at": 1767875288, // Event push timestamp (seconds)
"data": {
"incident_id": "incident_2026062900001", // Incident event ID
"workflow_uuid": "wf_uuid_xxxxxxxxxxxx", // Workflow UUID
"drone_sn": "1581F5BKD2380030XXXXX", // Operating aircraft serial number
"node_type": "command_task", // Node type: command_task (FlyTo task) / device_actions (device actions)
"status": 1, // Current node status code, depends on node_type; enumerations below:
// node_type = "command_task" (FlyTo task node):
// 0: Pending (non-terminal)
// 1: Executing (non-terminal)
// 2: Successful (terminal)
// 3: Manual intervention (terminal)
// 4: Execution failed (terminal)
// node_type = "device_actions" (device action node):
// 0: Successful (terminal)
// 1: Partially successful (terminal)
// 2: Failed (terminal)
// 3: In progress (non-terminal)
// 4: Manual intervention (terminal)
"is_false_alarm": false, // Whether marked as false alarm (real value only returned in terminal state; non-terminal is fixed to false)
"flight_id": "task_uuid_xxxxxxxxxxxx" // UUID of the current execution_task
}
}
Powiadomienie o przesłaniu pliku multimedialnego
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "media_file_uploaded",
"created_at": 1767875288,
"data": {
"organization_id": "org_123456_xxxxxx",
"project_id": "proj_789012_xxxxxx",
"file_id": "file_345678_xxxxxx",
"file_name": "DJI_20260108_120000_0001.JPG",
"file_type": "image/jpeg",
"file_size": 10485760,
"device_sn": "1581F6XXXXXX00A6XXXX",
"flight_id": "f17e2fa6-826a-48c5-a89a-fffe4093xxxx"
}
}
Powiadomienie o przesłaniu i aktualizacji plików tras lotu
{
"type": "wayline_file_uploaded",
"org_id": "1024dd05-34ce-46b6-a872-cb32b8c98f64",
"project_id": "38535b47-b972-4663-b1ce-5bd5a29224a4",
"created_at": 1769414678,
"data": {
"id": "testcda7-c97d-4bf6-8f8f-b490b9b18401", // Flight route ID
"name": "New waypoint route (2)", // Flight route name
"object_key": "1testd05-34ce-46b6-a872-cb32b8c98f64/test9b47-b972-4663-b1ce-5bd5test24a4/e5testb3-2cf8-49af-b49b-64test0032c7/New waypoint route (2).kmz", // Flight route object storage key
"type": 5 // File type. 5 indicates the flight route
}
}
Powiadomienie o zakończeniu rekonstrukcji modelu
{
"type": "model_post_reconstruction",
"org_id": "105ddd05-34ce-46b6-a872-cb32b8c98f64",
"project_id": "38559b47-b972-4663-b1ce-5bd5a29224a4",
"created_at": 1769414678,
"data": {
"id": "2e12cda7-c97d-4bf6-8f8f-btest9b18401", // Model ID
"name": "xx Model", // Model Name
"object_key": "105ddd05-34ce-46b6-a872-cb32b8c98f64/38559b47-b972-4663-b1ce-5bd5a29224a4/etestbb3-2cf8-49af-b49b-64b1610032c7/Model", // Model Object Storage Key
"type": 8//8: 2D model, 9: 3D model
}
}
Powiadomienie o nieprawidłowym wyjściu z RTH
{
"id": "9ab96be1-0231-4b2c-9892-2221188c323b",
"type": "device_exit_return_home",
"created_at": 1769400986,
"data": {
"action": 1,
"event_type": "device_exit_return_home",
"notify_type": "device_exit_return_home",
"organization_uuid": "8test46f-2cd5-476b-9f33-415c98de11a5",
"project_uuid": "8test9a5-d2ba-423d-a03e-e3b323c40810",
"reason": null, // Reason for the abnormal RTH exit: "2": "Behavior tree initialization failed"; "3": "Surrounded by obstacles"; "4": "Triggered flight restriction"; "5": "Obstacle too close"; "6": "No GPS signal"; "7": "GPS and VIO position output flags are false"; "8": "Large position error between GPS and VIO fusion"
"sn": "158TESTGD24BK0010114" // SN of the aircraft that undergoes the abnormal RTH exit
}
}
Powiadomienie o dodaniu/zmianie adnotacji organizacji
{
"created_at": 1772803375,
"data": {
"count": 1,
"download_url": "/openapi/v0.1/map/data-sync/files/33711783-bf96-440d-baa2-0e71afa1d485/f7356cd3-53de-4318-955f-306cbcc60ca2/0",
"format": "kml-gz",
"geometry_types": [
"polygon"
],
"sync_id": "annotation-f7356cd3-53de-4318-955f-306cbcc60ca2",
"sync_type": 0
},
"id": "5df19eca-65cf-4975-a942-09fdcfd7bdf9",
"org_id": "105ddd05-34ce-46b6-a872-cb32b8c98f64",
"project_id": "33711783-bf96-440d-baa2-0e71afa1d485",
"type": "map_geo_elements_update"
}
Wypchnięcie aktualizacji adresu RTSP
{
"converter_name": "Example Converter",
"converter_id": "29f4f54b-93af-4fd3-aed6-bd3d768082e9",
"sn": "SN1234567890",
"camera_index": "89-0-0",
"device_callsign": "DRONE-01",
"url": "rtsp://192.168.1.10:554/live/stream",
"username": "rtsp_user",
"password": "rtsp_password"
}
API FlightHub Mapping — postęp rekonstrukcji modelu
{
"msg_type": "model_reconstruction_percent_change", // Message type, model_reconstruction_percent_change=Model reconstruction, model_zip_change=Model compression
"resource_uuid": "7417bac3-00a4-4e07-b078-233c77e3fdf9",
"model_uuid": "3d33643c-de0d-4070-b155-8cf791e662e2",
"model_status": 14, // Reconstruction status, 9=Model compression, 12=Waiting for resources, 13=Failed to obtain resources, 14=Reconstruction in progress, 15=Reconstruction successful, 16=Reconstruction canceled
"model_size": 37353992,
"reconstruction_progress": 100, // Reconstruction progress, 0-100
"error_code": 0, // Reconstruction error code
"zip_status": 2, // Compression status, 1=Compression in progress, 2=Compression completed, 3=Failed to compress
"zip_progress": 100, // Compression progress 0-100
"zip_file_key": "https://test-file-storage.djicdn.com/5a6f9d4b-2a38-4b4b-86f9-3a678da0bf4a/open_reconstruction/7417bac3-00a4-4e07-b078-233c77e3fdf9/3D/3d33643c-de0d-4070-b155-8cf791e662e2.zip?auth_key=1767942603-0-0-150d3c28868e91dd2446aef97c26de85", // Download address of compressed output file
}