RegisterAlertEndpoint example

I need a php example of the RegisterAlertEndpoint api. There is nothing in your forum or documentation. I tried to use SoapClient, but got this error:

SoapFault exception: [HTTP] Authorization Required

Even though I entered my username and password in the options object.


Try starting out with one of the existing PHP samples that invokes any other FlightXML function first. Diving deep into the more complex API is not the best strategy.

Additionally, I see that your username “airgrubsystems” does not have any FlightXML API keys generated yet, so if that is the account you are using for development then you first need to go to

Is this what registering an endpoint looks like? Where does the API key go?

$options = array(‘trace’ => true, ‘exceptions’ => 0, ‘login’ => ‘myusername’, ‘password’ => ‘mypassword’,);
$client = new SoapClient(‘’, $options);
$params = array(“format_type” => “json/post”, “address” => “http://” . $data’domain’] . “/api/v2/services/index.php?action=alertCallback”);
$result = $client->RegisterAlertEndpoint($params);

Is this what setAlert looks like? Again, where does the API key go?

$options = array(‘trace’ => true, ‘exceptions’ => 0, ‘login’ => ‘myusername’, ‘password’ => ‘mypassword’);
$client = new SoapClient(‘’, $options);
$params = array(“alert_id” => “”, “ident” => $data’flight_number’] . $data’airline_code’], “origin” => $data’departure_airport’], “destination” => $data’arrival_airport’], “aircrafttype” => “”, “date_start” => $data’order_timestamp’], “date_end” => $data’order_timestamp’], “channels” => “{16 e_filed e_departure e_arrival e_diverted e_cancelled}”, “enabled” => “”, “max_weekly” => “1000”);
$result = $client->SetAlert($params);

Why is this the response to both?

SoapFault exception: [HTTP] Authorization Required

The API key is what you supply in the password argument for the $options array.

When the alert is triggered what does the post data look like? Is there any way for me to trigger test alerts?

I get back in the alert:


How do I get the flight update data from this?

For an example of what the Pushed Notification payload looks like, please see our documentation at … ation2.rvt

When using PHP to implement the endpoint, you’ll want to be parsing the raw POST body using something like this:

$postdata = file_get_contents("php://input")

There are no examples of the setAlert callback payload in the documentation. Can you post one here in the forum?

Go to that page and click “Show example (JSON push notification)…” and there are 3 examples of the JSON output that is sent to you.

Didn’t see it, thanks!