1

这就是我目前正在做的事情,应该在给定的巴士站返回给定巴士路线的巴士时间表

/routes/:routeIds/stops/:stopIds

如果我想在单个站点查找多条路线的时间表,或者为单个路线查找多个站点,这适用于,但我无法指定成对的特定路线和站点。

例如
,单个路线的多个站点/routes/100/stops/1,2,3
:单个站点的多个路线:/routes/100,101,103/stops/1

但我不能告诉它我想要'路线 100 在第 1 站'、'路线 101 在第 2 站'的时间表

我觉得我正在以错误的方式解决这个问题。

4

1 回答 1

1

One idea I can think of is just adding several routes and stops pairs to your path, e.g. routes/101,105/stops/4/routes/100/stops/4,9 will give you routes 101 and 105 for stop 4 and route 100 for stops 4 and 9.

Alternatively you could abandon the strict REST concepts and just refactor this into a POST request with JSON something like this: [{routes: [101, 105], stops: [4]}, {routes: [100], stops: [4, 9]}]. This might also be favourable if you plan to add more query parameters in the future, e.g. getting only accessible routes/stops for certain route/stop combinations.

于 2013-05-27T02:09:59.570 回答