public-transport / transport.rest

Information about the *.transport.rest APIs.
https://transport.rest/
34 stars 4 forks source link

västtrafik.transport.rest #6

Open linusromland opened 2 years ago

linusromland commented 2 years ago

Would love for you to add Västrafik to your API.

derhuerst commented 2 years ago

Do you have a URL where I can have a look at the API?

linusromland commented 2 years ago

https://developer.vasttrafik.se/portal/#/api/Reseplaneraren/v2/landerss @derhuerst

derhuerst commented 2 years ago

Unfortunately, we can't use this API right away.

There are two flavors of HAFAS APIs:

Both flavors have very similar semantics and naming schemes, but they differ significantly in their request/response format; This why covering both with a single client requires either quite a bit of duplicate code or quite complex abstraction layers. The work to adapt hafas-client to rest.exe APIs is ongoing, check out https://github.com/public-transport/hafas-client/pull/134 for details; A previous state of this PR has also been pulled out into https://github.com/public-transport/hafas-rest-client.

This why I see two obstacles to getting a v5.vasttrafik.transport.rest API running:

A minor obstacle: If the API is rate-limited (I'm not sure, but I assume that it is), on v5.vasttrafik.transport.rest, we should set a rate limit low enough, so that people don't accidentally "use up" all upstream requests and it is effectively not publicly available anymore.

If you would like to contribute, clarifying the legal/formal part would be awesome! You could help me by Google-Translate-/deepl-translating the relevant sections and double-checking that the translation sounds equivalent in a legal sense; I don't expect from you to give legal advice of course, but I assume that you can give your personal judgement.

Once everything is prepared, setting up the actual API server should be straightforward.

derhuerst commented 2 years ago

Now that I'm thinking about it, it would be a lot easier if we add the (static) authentication used by Västtrafik's HAFAS mobile app, which very likely uses the mgate.exe API, to hafas-client. If you would like contribute this, please follow hafas-client's instructions (please give feedback if that guide is not helpful).