OpendataCH / Transport

Swiss public transport API
http://transport.opendata.ch/
MIT License
246 stars 50 forks source link

/journeys resource #92

Open fabian opened 11 years ago

fabian commented 11 years ago

I'd like to add a resource for getting journey details and propose the following URI design for it:

/v1/journeys/tnr/{tnr}/cycle/{cycle}/puic/{puic}

It's not that nice as it includes external IDs, but this is the only way to get to the data, and connection and stationboard responses include this IDs in JHandle:

<JHandle tNr="202971" puic="085" cycle="03"/>
colinfrei commented 11 years ago

Why not use parameters? /v1/journeys?tnr={tnr}&cycle={cycle}&puic={puic} Having URL fragments implies a hierarchy of resources, which this doesn't seem to be. Or rather, I don't understand the parameters to say if it is or not. On that note, maybe more obvious parameters make sense...

fabian commented 11 years ago

You're right, there's no hierarchy between the parameters - at least none that I'm aware of. That's the main problem: We have no idea about the meaning of the parameters and I can't see how we could replace them… apart from making additional requests first? But then again it's not really guaranteed to return the specific journey.

/v1/journeys?from=Bern&to=Zürich&datetime=2013-09-17T12:02:00