/api/hazard/plane-crashes/1 кредитАвіакатастрофи
Збережений набір даних про авіаційні катастрофи з письмовим описом кожної, починаючи з 1920-х років. Це історичні дані про події, а не астрологічний розрахунок; вони доступні поряд з ендпоінтами карт, щоб час і місце катастрофи можна було одразу передати в карту. Фільтруйте за `country`, `region`, `aircraft`, `operator`, `crash_cause`, `flight_phase` і `flight_type` (усі — збіг за підрядком без урахування регістру), за `start_date` і `end_date` щодо дати катастрофи, а також за `min_fatalities`. `sort` приймає 'newest' (за замовчуванням), 'oldest', 'name_asc' і 'name_desc' за типом повітряного судна, а також 'fatalities_desc' або 'fatalities_asc'. Для пагінації — `page` і `itemsPerPage`: за замовчуванням п’ятдесят записів на сторінку, максимум п’ятсот. Відповідь — структура з пагінацією: `count`, `next`, `previous` і `results`. Кожен результат містить дату й місцевий час рядком, тип повітряного судна та оператора, фазу й тип польоту, класифікацію місця катастрофи й опис місця довільним текстом, країну й регіон, широту й довготу, кількість загиблих серед екіпажу, пасажирів, інших людей і загалом, указану причину `crash_cause` та абзац `circumstances` з описом того, що сталося.
https://api.occultapi.com/api/hazard/plane-crashes/Автентифікація
Передавайте ключ у заголовку X-API-Key. Ключ — це серверні облікові дані: ніколи не вставляйте його в JavaScript, що виконується в браузері, чи в мобільний застосунок.
X-API-Key: yt_live_a1b2c3d4_…Параметри запиту (13)
Передаються в URL-адресі. Усі необов’язкові, якщо не позначено інше, і їх можна поєднувати: спершу фільтр, потім сторінка, потім сортування.
| Параметр | Тип | Приклад | Призначення | |
|---|---|---|---|---|
| aircraft | string | — | Фільтр за повітряним судном (містить, без урахування регістру) ДОВІЛЬНИЙ; збіг за підрядком `icontains` без урахування регістру за типом повітряного судна. | |
| country | string | — | Фільтр за країною (містить, без урахування регістру) | |
| crash_cause | string | — | Фільтр за причиною катастрофи (містить, без урахування регістру) | |
| end_date | string | — | Фільтр за кінцевою датою (YYYY-MM-DD) Обмеження ФОРМАТУ: 'YYYY-MM-DD'. Порівнюється з `date__lte`. | |
| flight_phase | string | — | Фільтр за фазою польоту (містить, без урахування регістру) | |
| flight_type | string | — | Фільтр за типом польоту (містить, без урахування регістру) | |
| itemsPerPage | integer | — | Кількість елементів на сторінці | |
| min_fatalities | integer | — | Фільтр за мінімальною загальною кількістю загиблих | |
| operator | string | — | Фільтр за оператором (містить, без урахування регістру) ДОВІЛЬНИЙ; збіг за підрядком `icontains` без урахування регістру за оператором/авіакомпанією. | |
| page | integer | — | Номер сторінки | |
| region | string | — | Фільтр за регіоном (містить, без урахування регістру) | |
| sort | string | — | Порядок сортування: 'newest' (за замовчуванням), 'oldest', 'name_asc' (повітряне судно A-Z), 'name_desc' (Z-A), 'fatalities_desc' (спершу найбільше загиблих) або 'fatalities_asc' (спершу найменше) Без урахування регістру, пробіли обрізаються. За замовчуванням 'newest'. 'name_asc'/'name_desc' сортують за ТИПОМ ПОВІТРЯНОГО СУДНА (name_field='aircraft'), а не за іменем людини. Нерозпізнані значення мовчки замінюються на 'newest'. одне з: newest, oldest, name_asc, name_desc, fatalities_desc, fatalities_asc | |
| start_date | string | — | Фільтр за початковою датою (YYYY-MM-DD) Обмеження ФОРМАТУ: 'YYYY-MM-DD'. Порівнюється з `date__gte`. |
Приклад запиту
curl "https://api.occultapi.com/api/hazard/plane-crashes/" \
-H "X-API-Key: $OCCULT_API_KEY"Відповідь
{
"_truncated": true,
"_note": "Response shortened for the catalogue.",
"preview": "{\"count\": 100, \"next\": \"https://api.occultapi.com/api/hazard/plane-crashes/?page=2\", \"previous\": null, \"results\": [{\"id\": 100, \"date\": \"1926-09-29\", \"time\": \"23:55:00\", \"aircraft\": \"Farman F.60 Goliath\", \"operator\": \"French Air Force - Armée de l'Air\", \"flight_phase\": \"Flight\", \"flight_type\": \"Training\", \"crash_site\": \"Plain, Valley\", \"crash_location\": \"Bonneval Eure-et-Loir\", \"country\": \"France\", \"region\": \"Europe\", \"latitude\": 48.18118, \"longitude\": 1.386218, \"crew_fatalities\": 5, \"pax_fatalities\": 0, \"other_fatalities\": 0, \"total_fatalities\": 5, \"circumstances\": \"The crew was performing a night training flight on behalf of the 3rd Squadron of the 22nd regiment based in Chartres. While flying in the region of Bonneval, some 20 km south of Chartres, the aircraft caught fire. The pilot reduced his altitude and attempted an emergency landing. From a height of 50 meters, the aircraft stalled and crashed in a huge explosion. All five occupants were killed. Crew: Lt Jules Gindre, pilot, Sgt Pierre Pacaud, navigator, Sgt Roger Duchatelle, navigator, Sgt Raymond Rigault, mechanic, Pvt Jean Frémont, radio.\", \"crash_cause\": \"Technical failure\"}, {\"id\": 99, \"date\": \"1926-09-21\", \"time\": \"11:45:00\", \"aircraft\": \"De Havilland DH.4\", \"operator\": \"United States Army Air Corps - USAAC\", \"flight_phase\": \"Takeoff (climb)\", \"flight_type\": \"Military\", \"crash_site\": \"Airport (less than 10 km from airport)\", \"crash_location\": \"Kenley AFB Surrey\", \"country\": \"United Kingdom\", \"region\": \"Europe\", \"latitude\": 51.32609, \"longitude\": -0.101269, \"crew_fatalities\": 0, \"pax_fatalities\": 1, \"other_fatalities\": null, \"total_fatalities\": 1, \"circumstances\": \"Shortly after takeoff from RAF Kenley, while climbing, the engine failed. The aircraft stalled and crashed into trees, bursting into flames. The aircraft was destroyed and both occupants were seriously injured. The pilot died from his injuries five days later. The aircraft was based at RAF Kenley and operated on behalf of the US Embassy in London. Crew: Maj Clarence Leonard Tinker. Passenger: Cdr Robert Andrew Burg. †\", \"crash_cause\": \"Technical failure\"}, {\"id\": 98, \"date\": \"1926-09-16\", \"time\": \"20:20:00\", \"aircraft\": \"De Havilland DH.4\", \"operator\": \"Robertson Aircraft Corporation\", \"flight_phase\": \"Flight\", \"flight_type\": \"Postal (mail)\", \"crash_site\": \"Plain, Valley\", \"crash_location\": \"Ottawa Illinois\", \"country\": \"United States of America\", \"region\": \"North America\", \"latitude\": 41.346844, \"longitude\": -88.842645, \"crew_fatalities\": 0, \"pax_fatalities\": 0, \"other_fatalities\": 0, \"total_fatalities\": 0, \"circumstances\": \"The pilot Charles Lindbergh was performing a mail flight from Peoria to Chicago. En route, weather conditions worsened and he lost his orientation. Few minutes later, fuel exhausted and he eventually took the decision to bail out and abandoned the aircraft that crashed in a corn field. While the aircraft was destroyed, the aviator was unhurt.\", \"crash_cause\": \"Technical failure\"}, {\"id\": 97, \"date\": \"1926-08-20\", \"time\": \"16:05:00\", \"aircraft\": \"Hanriot HD.1\", \"operator\": \"Swiss Air Force\", \"flight_phase\": \"Flight\", \"flight_type\": \"Training\", \"crash_site\": \"Airport (less than 10 km from airport)\", \"crash_location\": \"Basel-Sternenfeld Basel City\", \"country\": \"Switzerland\", \"region\": \"Europe\", \"latitude\": 47.555943, \"longitude\": 7.588639, \"crew_fatalities\": 1, \"pax_fatalities\": 0, \"other_fatalities\": 0, \"total_fatalities\": 1, \"circumstances\": \"The pilot was performing a training flight at Basel-Sternenfeld Airport. While completing manoeuvre, he lost control of the aircraft that entered a dive and crashed near the airfield. The pilot was killed.\", \"crash_cause\": \"Human factor\"}, {\"id\": 96, \"date\": \"1926-08-18\", \"time\": \"14:30:00\", \"aircraft\": \"Blériot 155\", \"operator\": \"Air Union France\", \"flight_phase\": \"Flight\", \"flight_type\": \"Scheduled Revenue Flight\", \"crash_site\": \"Plain, Valley\", \"crash_location\": \"Ashford Kent\", \"country\": \"United Kingdom\", \"region\": \"Europe\", \"latitude\": 51.1493"
}Записано з реального виклику з точно таким запитом, як вище. Результати лежать у data.
Помилки
Помилки обліку кредитів мають вигляд { "error": "…", "message": "<code>", "is_error": true }. Людям показуйте error, а логіку будуйте на message. Детальніше — у довіднику помилок.