GTFS alerts API
GTFS alerts API
DCTA route alerts can be read from the Swiftly GTFS-Realtime alerts feed. This page documents the request. It does not include the API key or the agency key.
Request
- Method: GET
- URL:
https://api.goswift.ly/real-time/{agencyKey}/gtfs-rt-alerts/v2 - Header:
Authorizationset to the Swiftly API key agencyKeyis the path segment afterdashboard.goswift.ly/in the Swiftly dashboard
The default body is GTFS-Realtime protobuf. Add ?format=json for the same feed as JSON, or ?format=human for a text snapshot.
Feed fields
header.gtfs_realtime_version— specification versionheader.incrementality—FULL_DATASETheader.timestamp— Unix time when the feed was builtentities[].id— alert identities[].alert.active_period[].startandend— Unix time. One of the two may be omittedentities[].alert.informed_entity[]—agency_id,route_id, andstop_identities[].alert.cause— cause enum from the GTFS-Realtime specentities[].alert.effect— effect enum from the GTFS-Realtime specentities[].alert.header_text[].translation[].text— short title.languageis optionalentities[].alert.description_text[].translation[].text— longer descriptionentities[].alert.url— optional link
How this site stores an alert
Swiftly alerts are saved as the hidden external-alert post type, using the same fields as Route Alerts:
- header text becomes the post title
- description text becomes
details - active period start becomes
effective_date - active period end becomes
archive_date route_idbecomesimpacted_routes- the entity id is stored as
gtfs_alert_id
The API key is encrypted in the database with a plugin-generated secret. That secret is not taken from wp-config.php. The key is not shown on this page.