Till senaste kommentaren
Detta inlägg är gammalt och kan innehålla inaktuell information.

How to get ServiceDays of a train in resrobot within the timetbale period?

I have subscribed to resrobot and can do requests successfully. But I only get ServiceDays data of a train if I do the request for a date when this train is running. Any way to get this general information with a generic request by setting only
&originId= &destId= &maxChange=0 &time= ?
My current (successful) request:
https://api.resrobot.se/v2/trip?key=[]&originId=740000115&destId=740000003&format=json&maxChange=0&date=2021-01-03&time=16:45

If I do a request without date, I get "SVC_NO_RESULT" because the requested train does not run on the current date. But how do I get the general data (ServiceDays) for a specific train (#3901) by generic request?

Any suggestion?

Kommentarer

  • Hej Johannes,

    You can obtain the (binary) ServiceDays pattern by searching for the specific trip, so you will have to enter a valid date first (since the trip/servicedays depends on the date). Unfortunately, we don't have an endpoint for specific train numbers at this moment.

    You could consider using the GTFS Sverige 2 data, which is exactly the same data as ResRobot Reseplanerare uses. You can either filter out the relevant data for yourself, or you can use a software package like OpenTripPlanner to create your own API from the data.

    Regards,
    Bert
    Bert på Trafiklab

Kommentera eller skriv ett nytt inlägg

Ditt namn och inlägg kan ses av alla. Din e-post visas aldrig publikt.