Subway GTFS-rt: Response "The specified key does not exist."

58 views
Skip to first unread message

JP

unread,
Aug 8, 2023, 2:48:21 PM8/8/23
to mtadeveloperresources
I am in the process of (re-)enabling NYCT Subway GTFS-rt on my client side. I am already covering several other GTFS-rt feeds, e.g. BART, without problem.
The account that I signed up for years ago has been wiped, along with the API key I received at the time. So I signed up for a new developer account and received a new API key. This authorizes my requests: Adding the API key in the request header, I receive a response code 200 as opposed to 403 when it is missing. So far so good.
The response content however is not GTFS-rt; I receive (ResponseId and HostId edited):
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>nyct/gtfs1</Key><RequestId>GS ... C</RequestId><HostId>H4cZJOX7 ... pSHDWBRooTHxc9A=</HostId></Error>
I let this sit overnight in case my new registration needed time to propagate, but no luck. Here is a Java code snippet for calling GTFS-rt APIs; this works for all other GTFS-rt feeds that I cover (edited for clarity):
    URL url = new URL(requestString);
    URLConnection connection = url.openConnection();
    HttpURLConnection httpConnection = (HttpURLConnection)connection;
    String authToken = "__ my key __";
    httpConnection.setRequestProperty("x-api-key", authToken);
    InputStream ins = httpConnection.getInputStream();
    String result = IOUtils.toString(ins, StandardCharsets.UTF_8);
# result as posted above " The specified key does not exist."
JP

Sunny

unread,
Aug 8, 2023, 2:56:43 PM8/8/23
to mtadeveloperresources
You have a stray 1 at the end of your URL. The A Division (1-7) GTFS is located at https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs

JP

unread,
Aug 8, 2023, 4:24:21 PM8/8/23
to mtadeveloperresources
Great catch, thank you - that was a carry-over from the old GTFS feeds.
JP
Reply all
Reply to author
Forward
0 new messages