Registering call Back
import requests
apiUrl = “https://aeroapi.flightaware.com/aeroapi/”
apiKey = ‘XXXXXXXXXXXXXXXXXXX’
headers = {
‘Accept’: ‘application/json; charset=UTF-8’,
‘x-apikey’: f’{apiKey}',
‘Content-Type’: ‘application/json; charset=UTF-8’,
}
data = {“url”:“https://34d7-1232410-174-9-1222230.ngrok.io/callback”}
response = requests.put(‘https://aeroapi.flightaware.com/aeroapi/alerts/endpoint’, headers=headers, json=data)
GOT THE FLIGHT DETAILS
curl -X GET “https://aeroapi.flightaware.com/aeroapi/flights/QF1”
-H “Accept: application/json; charset=UTF-8”
-H “x-apikey: XXXXXXXXXXXX” \
{
“ident”: “QFA1”,
“fa_flight_id”: “QFA1-1644212744-airline-0379”,
“operator”: “QFA”,
“operator_iata”: “QF”,
“flight_number”: “1”,
“registration”: null,
“atc_ident”: null,
“inbound_fa_flight_id”: null,
“codeshares”: ,
“blocked”: false,
“diverted”: false,
“cancelled”: false,
“position_only”: false,
“origin”: {
“code”: “YPDN”,
“airport_info_url”: “/airports/YPDN”
},
“destination”: {
“code”: “EGLL”,
“airport_info_url”: “/airports/EGLL”
},
“departure_delay”: 0,
“arrival_delay”: 0,
“filed_ete”: 61500,
“scheduled_out”: “2022-02-09T11:40:00Z”,
“estimated_out”: null,
“actual_out”: null,
“scheduled_off”: “2022-02-09T11:50:00Z”,
“estimated_off”: “2022-02-09T11:50:00Z”,
“actual_off”: null,
“scheduled_on”: “2022-02-10T04:55:00Z”,
“estimated_on”: “2022-02-10T04:55:00Z”,
“actual_on”: null,
“scheduled_in”: “2022-02-10T05:05:00Z”,
“estimated_in”: null,
“actual_in”: null,
“progress_percent”: 0,
“status”: “Scheduled”,
“aircraft_type”: “B789”,
“route_distance”: 8628,
“filed_airspeed”: 439,
“filed_altitude”: null,
“route”: null,
“baggage_claim”: null,
“seats_cabin_business”: null,
“seats_cabin_coach”: null,
“seats_cabin_first”: null,
“gate_origin”: null,
“gate_destination”: null,
“terminal_origin”: null,
“terminal_destination”: “3”,
“type”: “Airline”
},
USED the above details to create alert
payload = {
“ident”: “QFA1”,
“origin”: “YPDN”,
“destination”: “EGLL”,
“type”: “Airline”,
“aircraft_type”: “B789”,
“start”: “2022-02-09T11:50:00Z”,
“end”: “2022-02-10T05:05:00Z”,
“max_weekly”: 0,
“eta”: 0,
“events”: {
“arrival”: False,
“cancelled”: True,
“departure”: False,
“diverted”: True,
“filed”: False,
},
}
auth_header = {‘x-apikey’:apiKey}
response = requests.post(apiUrl + f"alerts", params=payload, headers=auth_header)
Still get the same response.
{‘title’: ‘Missing’, ‘reason’: ‘MISSING’, ‘detail’: ‘no event types specified for channel_id 21 in {channels}’, ‘status’: 400}
Anybody from flightaware can you please help me?. No source code to read and documentation to refer. Any help would be highly appreciated. what is channel? what is channel id? . We were asked register callback and call API as per the documentation?. Please help.