Create alert error 'no event types specified for channel_id'

Resistered endpoint:

import requests

apiKey = ‘XXXXXXXXXXXXXXXXX’
apiUrl = “https://aeroapi.flightaware.com/aeroapi/

payload ={
“url”: “http://example.com
}

auth_header = {‘x-apikey’:apiKey}

response = requests.put(apiUrl + f"alerts/endpoint",
json=payload, headers=auth_header)

After that trying to create alert.

payload = {
“ident”: “PC784”,
“origin”: “PRN”,
“destination”: “SAW”,
“type”: “Airline”,
“aircraft_type”: “string”,
“start”: “2022-01-06T16:15:00+03:00”,
“end”: “2022-01-06T18:30:00+03:00”,
“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)

Keep getting this error

{‘title’: ‘Missing’, ‘reason’: ‘MISSING’, ‘detail’: ‘no event types specified for channel_id 21 in {channels}’, ‘status’: 400}

No idea what is wrong. any help would be highly appreciated.

You seem to be trying to create an alert that is in the past.

Thanks @LawrenceHill . I tried with in future as well, no difference payload = { "ident": "PC784", "origin": "PRN", "destination": "SAW", "type": "Airline", "aircraft_type": "string", "start": "2022-02-10T16:15:00+03:00", "end": "2022-02-10T18:30:00+03:00", "max_weekly": 0, "eta": 0, "events": { "arrival": False, "cancelled": True, "departure": False, "diverted": True, "filed": False, }, }

PC784 doesn’t seem to fly between PRN and SAW, it is TLV to SAW.

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.

The alerts resources expect a posted json payload, not URL parameters. Your alert config should work if you change
response = requests.post(apiUrl + f"alerts", params=payload, headers=auth_header)
to
response = requests.post(apiUrl + f"alerts", json=payload, headers=auth_header)

A successful post will have a response.status_code of 201.

The error case here isn’t expected, so we’ll make sure to update that to be much more clear.

Thanks @dogrock . Good find.