Use GTFS API to recreate "Service Status"

347 views
Skip to first unread message

clevercommute

unread,
Jun 21, 2022, 11:50:49 AM6/21/22
to mtadeveloperresources
My dev is trying to use the GTFS API to effectively create a version of the picture below. 

Does anyone have guidance on how to do that? 
I have pasted our troubleshooting code below (and the results we get...which do NOT match the "Service Status")

HowTo.png

$headers = ['x-api-key: XXXXXXXXXXXXXXXXXXX']; 
 $curl = curl_init(); 
 curl_setopt( $curl, CURLOPT_URL, $apiUrl ); 
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); 
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers); 

 try { $results = json_decode(curl_exec($curl), true, 512, JSON_THROW_ON_ERROR); } catch (JsonException $e) 
 echo $e; 
 exit(); 
}

----
What we do get 

suspended
multiple impacts
part suspended
trains rerouted
delays
service change
local to express
express to local
stations skipped
some delays
slow speeds
planned work
good service
on or close
boarding change
weekday service
special schedule
extra service
planned - substitute buses
planned - part suspended
planned - stations skipped
reduced service
special event
no scheduled service
planned - boarding change
saturday schedule
station notice
sunday schedule
weekend schedule


Sam Salkin

unread,
Jun 23, 2022, 11:50:52 AM6/23/22
to mtadeveloperresources
Hi there - Internally, we are shifting away from "Service Status" as a concept because classifying a line's status by the most severe incident on the line tends to obscure other alerts impacting a line that may be more relevant to one's travel. You can expect to see this more in customer-facing products down the road.

If you want to recreate this on your end, I'd recommend re-reviewing the documentation for our GTFS Alerts feed. (https://groups.google.com/g/mtadeveloperresources/c/fu3q3n_I2J0/m/LziRXc0aBQAJ). 

The value of the alertType with the highest integer in the sortOrder field for all alerts on a given line would be its "status". The "displayBeforeActive" field is what we use to key off if a Planned Service Change does or doesn't show up in our status box. (For some long-term service changes, we do not publish them in the status box) The absence of the field means it would not show up in the status box. All alerts for unplanned/real-time disruption show up in the status box by default (and have an integer value of 0).

I hope this helps!

clevercommute

unread,
Jun 23, 2022, 6:53:44 PM6/23/22
to mtadeveloperresources
Hi 

This is helpful. I will work with my devs to determine feasibility. 

Can you please provide dates for deco of Service Status?
It was 1/2 a year ago that you counseled me away from Service Status, and yet it's still in prod use, and we don't know when it's going away. 

We don't want to build throw-away work, but we have to make business decisions about what/when to build. 

Thanks, 

jge...@gmail.com

unread,
Jun 24, 2022, 2:33:57 PM6/24/22
to mtadeveloperresources
Sorry for any confusion. we've been advising folks to move away from it for a few years now. We stopped listing in publicly about a year ago.  

I'm actually surprised it's still working, and wouldn't be surprised if the data hasn't been totally accurate even if it's not broken. The fact it's still up speaks more to some of the challenges on our side wrangling legacy things than any strategy. 

For planning purposes, move to the alerts API. We're working on a guide about how to recreate a service status box using the alerts feed, which we'll have ready early next week and post publicly on our website. 


Tim Fowle

unread,
Jun 27, 2022, 9:03:34 AM6/27/22
to mtadeveloperresources
Hello 
Can you just clarify something for me.
You say youve been advising people to move away from the "service status" feeds.  I assumed this meant moving from the very old service status feed to the GTFS-RT alerts or the "Service Alerts" GTFS feed (and its json version).
But you also say you are moving away from ""Service Status" as a concept".
Is this something that will disappear from your homepage https://new.mta.info/
If so is this likely to happen soon (weeks/months) or a longer term aim?


Thanks

clevercommute

unread,
Jun 29, 2022, 10:27:53 PM6/29/22
to mtadeveloperresources
Regarding " We're working on a guide about how to recreate a service status box using the alerts feed, which we'll have ready early next week and post publicly on our website.", 

is this still on target for delivery by July 1?

Thank you

clevercommute

unread,
Jul 5, 2022, 9:35:44 PM7/5/22
to mtadeveloperresources
Please let me know. Thanks

clevercommute

unread,
Jul 11, 2022, 7:11:52 PM7/11/22
to mtadeveloperresources
Hi - 

Can you please let me know? 

Thanks

-Josh 

clevercommute

unread,
Jul 17, 2022, 9:54:25 AM7/17/22
to mtadeveloperresources
ETA please. Thank you

Sam Salkin

unread,
Jul 18, 2022, 10:03:34 AM7/18/22
to mtadeveloperresources
Hi Josh - we'd published this last week and never provided the link back to the dev list. That's on us. You can read the guide here: https://new.mta.info/developers/service-status-box

--Sam

clevercommute

unread,
Jul 18, 2022, 12:31:45 PM7/18/22
to mtadeveloperresources
Thank you. 
We will check it out. 
FYI - there may be 2 small typos in the link you shared 

--Josh 

2022-07-18_12-29-19.png

Mel Laytner

unread,
Mar 5, 2024, 2:44:57 PMMar 5
to mtadeveloperresources
I'm confused. Back in '22 there were posts about the MTA "moving away" from subway status bar API.
1. Since 2022, is there a new NYC Subways API that we can download?
2. If not, where can we find the older or current API? (please send me the url address)
3. Please note BuildingLink, the communication interface for hundreds of apartment buildings, offers a subway "status box" that's displayed in scores of apartment lobby message screens throughout the city. Where do they get this from?

Thanks,
Mel Laytner

Sunny

unread,
Mar 8, 2024, 7:22:12 AMMar 8
to mtadeveloperresources
The guide at  https://new.mta.info/developers/service-status-box remains up to date, the Alerts API on api.mta.info is the current one.

MTA cannot speak for what APIs or logic a third party consumer is using in their products. We have not provided BuildingLink with any bespoke feeds or information.
Reply all
Reply to author
Forward
0 new messages