ACARS

The procedure for ACARS applications has changed in this version of phpVMS. The reason for the changes brings several new features:

  • All ACARS data is now tied to a PIREP
  • Any updates provided by an ACARS application are all saved as history, viewable with a PIREP
  • ACARS data can be retrieved

All ACARS API calls are done with the user's API key (see the REST Interface page) The procedure for ACARS roughly is:

  1. POST the /api/pireps/prefile with some of the PIREP planned information. It will return a pirep_id
  2. POST ACARS data updates to /api/pireps/{PIREP_ID}/acars.
  3. When the PIREP is ready to be filed, POST to /api/pireps/{PIREP_ID}/file, passing in any of the PIREP information to be updated

The route is displayed, with an example of the body JSON below it


Example:

POST /api/pireps/prefile
{
   "airline_id": "{THE AIRLINE ID FOR THE FLIGHT}",
   "aircraft_id": "{THE AIRCRAFT ID FOR THE FLIGHT}",
   "flight_id": "{THE ID OF THE FLIGHT}",
   "dpt_airport_id": "{ICAO OF THE DEPARTURE AIRPORT}",
   "arr_airport_id": "{ICAO OF THE ARRIVAL AIRPORT}",
   "level": {PLANNED ALTITUDE},
   "planned_flight_time": {ESTIMATED FLIGHT TIME IN MINUTES},
   "route": "{PLANNED FLIGHT ROUTE}"
}

After a PIREP has been prefiled, you can also set the route for the PIREP. These route navpoints don't need to exist or be imported server-side (e.g, updating the nav database), since the coordinates are also stored

POST /api/pireps/{PIREP ID}/route
{
    "route": [
        {
           "name":        [FIX NAME],
           "order":       [INTEGER, 1 ... N],
           "nav_type":    [See Enums\NavAidType, Optional],
           "lat":         -37.024312,
           "lon":         53.297282,
           "created_at":  [ISO8601 in UTC]
        },
        ...
    ]
}

To erase the route, a DELETE call can be made. This can be used there's an update to the scheduled route or change

DELETE /api/pireps/{PIREP ID}/route

ACARS position updates are provided as a list of objects. You can provide one, or many as a batch update

POST /api/pireps/{PIREP ID}/acars/position
{
    "positions": [
        {
           "lat":         -37.024312,
           "lon":         53.297282,
           "log":         [ANY STRING, OPTIONAL],
           "heading":     [INTEGER, OPTIONAL],
           "altitude":    [INTEGER, OPTIONAL],
           "vs":          [INTEGER, OPTIONAL],
           "gs":          [UNSIGNED INTEGER, OPTIONAL],
           "transponder": [UNSIGNED INTEGER, OPTIONAL],
           "autopilot":   [STRING, OPTIONAL],
           "fuel_flow":   [FLOAT, OPTIONAL],
           "sim_time":    [STRING, OPTIONAL],
           "created_at":  [ISO8601 in UTC]
        },
        ...
    ]
}

You can also retrieve all of the position updates, in case you want to reconcile. Each waypoint is assigned an ID.

GET /api/pireps/{PIREP ID}/acars/position

ACARS log updates are provided as a list of objects. You can provide one, or many as a batch update

POST /api/pireps/{PIREP ID}/acars/log
{
    "logs": [
        {
           "log":         [ANY STRING, REQUIRED],
           "lat":         -37.024312 (OPTIONAL),
           "lon":         53.297282 (OPTIONAL),
           "created_at":  [ISO8601 in UTC, OPTIONAL]
        },
        ...
    ]
}

Any data is optional in this step. The data supplied will be updated in the main PIREP itself.

POST /api/pireps/{PIREP ID}/file

See the fields for prefile


In case a PIREP needs to be cancelled, this route can be called. Note, it will no-longer accept any ACARS updates

POST /api/pireps/{PIREP ID}/cancel