GTFS-RT Broadcasters

Support GTFS-RT requests

If the user adds a GTFS-RT broadcaster to a Partner, like gtfs-rt-trip-updates-broadcaster, gtfs-rt-vehicle-positions-broadcaster, etc

For example:

1 2 3 4 5 6 7 8 9 POST /<referential_slug>/partners { "slug": "test", "connectorTypes": [ "gtfs-rt-trip-updates-broadcaster" ], "settings": { "local_credential": "secret", "remote_objectid_kind": "internal" } }

Then the user can perform GTFS requests:

1 2 3 GET /<referential_slug>/gtfs GET /<referential_slug>/gtfs/trip-updates GET /<referential_slug>/gtfs/vehicle-positions

Endpoints

The user can select the expected GTFS-RT entities by using one of the GTFS-RT endpoints:

Global endpoint /<referential_slug>/gtfs

This endpoint provides all entities. If no GTFS-RT broadcaster is defined (gtfs-rt-trip-updates-broadcaster, gtfs-rt-vehicle-positions-broadcaster, etc), this endpoint returns a 501 status code.

Trip Update endpoint /<referential_slug>/gtfs/trip-updates

This endpoint provides only Trip Update entities. If the gtfs-rt-trip-updates-broadcaster is not defined into the associated Partner, this endpoint returns a 501 status code.

Vehicle Position endpoint /<referential_slug>/gtfs/vehicle-positions

This endpoint provides only Trip Update entities. If the gtfs-rt-vehicle-positions-broadcaster is not defined into the associated Partner, this endpoint returns a 501 status code.

Authentication

The user can specify a credential in the GTFS-RT request by using an HTTP header Authorization with this syntax : for secret token, Authorization: Token token=secret

1 2 GET /<referential_slug>/gtfs Authorization: Token token=secret

If a token is given into the GTFS-RT request, the Partner associated to the request will be find by local_credential.

If no token is given into the GTFS-RT request, the Partner without local_credential will be associated to the request.

For example, with the following Partners:

  • Partner A, with local_credential: secret

  • Partner B, with local_credential: other

  • Partner C, with no local_credential

The following request:

1 2 GET /bibus/gtfs Authorization: Token token=secret

will be associated to the Partner A.

The following request:

1 GET /bibus/gtfs

will be associated to the Partner C.

The following request:

1 2 GET /bibus/gtfs Authorization: Token token=dummy

will return a 401 HTTP status code.

GTFS-RT response

The GTFS-RT response contains a Feed Message structure as described in the GTFS-RT reference.

The following content is managed by Ara:

FeedMessage

  • FeedHeader

    • Incrementality

  • FeedEntity

    • TripUpdate

      • TripDescriptor

      • StopTimeUpdate

        • StopTimeEvent

    • VehiclePosition

      • TripDescriptor

      • Position

All GTFS-RT responses respect this structure.

The TripUpdate entities are provided only if the user request selects them and if the gtfs-rt-trip-updates-broadcaster is associated to the Partner. See the associated story for content details.

The VehiclePosition entities are provided only if the user request selects them and if the gtfs-rt-vehicle-positions-broadcaster is associated to the Partner. See the associated story for content details.

Complete example (in pseudo json content)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 { "header": { "gtfs_realtime_version": "2.0", "incrementality": "FULL_DATASET", "timestamp": "1580136888" }, "entity": [ { "id": "trip:281721", "trip_update": { "trip": { "trip_id": "281721", "route_id": "3001I", "start_time": "16:36:00" }, "stop_time_update": [ { "stop_sequence": 1, "departure": { "time": "1580135775" }, "stop_id": "1020503" }, { "stop_sequence": 2, "arrival": { "time": "1580136050" }, "departure": { "time": "1580136050" }, "stop_id": "1174501" }, { "stop_sequence": 3, "arrival": { "time": "1580136234" }, "stop_id": "1250501" } ] } }, { "id": "vehicle:943", "vehicle": { "trip": { "trip_id": "281721", "route_id": "3001I", "start_time": "16:36:00" }, "position": { "latitude": 60.27628707885742, "longitude": 24.856653213500977, "bearing": 133 }, "vehicle": { "id": "943" } } } ] }

General attributes

FeedHeader attribute

Value

FeedHeader attribute

Value

gtfs_realtime_version

“2.0”

incrementality

FULL_DATASET

timestamp

According to the current time on response creation

Broadcast Vehicle Journey data via a GTFS-RT Trip Updates Broadcaster

When the user requests the GTFS-RT Trip Updates, Ara returns a GTFS-RT Trip Update entity for each Vehicle Journey which have at least a Stop time in the future, with the following attributes:

FeedEntity attribute

Value

id

“trip:<vehicle journey.objectid>”

TripDescriptor attribute

Value

trip_id

Vehicle Journey objectid

route_id

Line objectid

start_time

First Stop Visit actual or expected or aimed departure time

StopTimeUpdate attribute

Value

stop_sequence

Stop Visit PassageOrder

stop_id

Stop Area objectid

arrival

Stop Visit absolute actual or expected or aimed arrival time if defined

departure

Stop Visit absolute actual or expected or aimed departure time if defined

Trip Update Entity example (in pseudo json content)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 { "id": "trip:281721", "trip_update": { "trip": { "trip_id": "281721", "route_id": "3001I", "start_time": "16:36:00" }, "stop_time_update": [ { "stop_sequence": 1, "departure": { "time": "1580135775" }, "stop_id": "1020503" }, { "stop_sequence": 2, "arrival": { "time": "1580136050" }, "departure": { "time": "1580136050" }, "stop_id": "1174501" }, { "stop_sequence": 3, "arrival": { "time": "1580136234" }, "stop_id": "1250501" } ] } }

Broadcast Vehicle data via a GTFS-RT Vehicle Position Broadcaster

When the user requests the GTFS-RT Trip Updates, Ara returns a GTFS-RT Vehicle Position entity for each Vehicle with the following attributes:

TripDescriptor attribute

Value

trip_id

Vehicle Journey objectid

route_id

Line objectid

start_time

First Stop Visit actual or expected or aimed departure time

StopTimeUpdate attribute

Value

stop_sequence

Stop Visit PassageOrder

stop_id

Stop Area objectid

arrival

Stop Visit absolute arrival time (actual or expected or aimed) if defined

departure

Stop Visit absolute departure time (actual or expected or aimed) if defined

VehiclePosition attribute

Value

latitude

Vehicle latitude

longitude

Vehicle longitude

bearing

Vehicle bearing if defined

VehicleDescription attribute

Value

id

Vehicle objectid

Vehicle Position Entity example (in pseudo json content)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 { "id": "vehicle:943", "vehicle": { "trip": { "trip_id": "281721", "route_id": "3001I", "start_time": "16:36:00" }, "position": { "latitude": 60.27628707885742, "longitude": 24.856653213500977, "bearing": 133 }, "vehicle": { "id": "943" } } }