Open scvnc opened 2 years ago
I totally understand your use case here and also have no idea why I don't have the estimated arrival/departure on the stations endpoint. You've actually caught me at the right time as I am currently working on rewriting the API currently (should be done by Sunday) and I'll make sure that the train and station objects are standardized through all endpoints.
@piemadd any updates? Want to meet up in Chi town? I want to help bolster and test this lib
Sorry for taking a while, just finished the new API, which is live at https://api-v3.amtraker.com/v3. I'm currently working on porting Amtrak.js over to operate with this api. It has some breaking changes from the previous api, one of which is to move away from including train information in station requests, and instead including a list of train ids ([train number]-[day of the month the train originated]), like this:
you can try it out here: https://api-v3.amtraker.com/v3/trains https://api-v3.amtraker.com/v3/trains/6 https://api-v3.amtraker.com/v3/stations/NYP https://api-v3.amtraker.com/v3/stations
first off: nice job, thank you for making this data way more accessible! I understand part of this issue is likely from just how amtrak is making the data available.
Viewing train from
/trains/{number}
endpointnotice estArr, estDep included.
Viewing train from
/stations/{code}
endpointnotice estArr, estDep not included
It would be nice if in the /stations/{code} endpoint, the shape was the same.
My use case
Simply get my train and see when it's Amtrak-reported estimated arrival is. Not sure how to query that robustly yet. The /trains endpoint has the nice info but I'd likely have filter by station/date in some (totally possible) way.
deeper use case: omg I love amtrak but the chicago bound train is scheduled to slide through at 3:20am and is usually 1 to 5 hours late. Gotta pipe this data into a cron script that tells Twilio to spam my phone an hour before the train is about to arrive so that I can get the maximum amount of sleep. Open for collab on that :)