Repository navigation
Open
Labels
Description
Ideas for a new "version 2" of the /route endpoint:
request:
- use JSON request instead URL parameter
- keep the name
/routebut just support POST?/flexiblewould make no sense as we want to use the advantages of a POST request also for CH that is currently not flexible. - remove insecure JSONP
- The input
pointshould be better named e.g.waypointthen one can easily usewaypointsfor the output JSON name, see JSON output should contain snapped points for start, destination and via points #727 - use
waypoints_orderinstead ofpoints_order - include heading for all instructions?
-
way_point_max_distanceclashes withmax_waypoint_distancesee Added Max Point Distance for Non-Ch Requests #872 -
vehiclevs.profile(e.g. foot is no vehicle) - should we make ch.disable=true the new default? Or even use LM as the new default? Not now.
- make input and output points more consistent all using [lon,lat,elevation] and output using GeoJSON? Same applies to the polyline encoding: the encoded string for
pointsandsnapped_waypointshas the order lat,lon,elevation to make it compatible with other clients but we should use lon,lat,elevation
response:
- different APIs of the Directions API should use same time unit: seconds (currently routing API has ms)
- different layout for via-points? 'legs', what about changing the vehicle -> multi modal?
- turn_angle is in radian
- Also see Add speed, time and more informations to instructions #439 as some properties could be per edge not per instruction
- change default for GPX: export only track?
- use different wording for
pointse.g. usegeometry? - use different wording for
pathse.g.routes? - info endpoint should be improved, either via profile_x:{} (and remove features) or a different layout
- remove 'took' from output, see Remove took from json, use header instead #457
- make i18n response more consistent or remove the need for a separate endpoint
- do not use the same JSON entry
pointsfor encoded polyline and GeoJSON as we get problems with OpenAPI spec (alternatives not possible) when the user would try to do the decoding on his side with an autogenerated client
Activity
michaz commentedon May 12, 2017
Are there any examples where this is considered a good idea? I thought the whole point about REST was that a resource is identified by its URL alone, and a shortest path is the perfect example of a resource.
navitia.io seems to agree.
karussell commentedon May 12, 2017
ElasticSearch, our Route Optimization API, mapzen, ...
Why? There are lots of possible parameters. E.g. it is time, vehicle size etc dependent. I do not see it as a resource. I see it more as a 'calculation job'...
michaz commentedon May 13, 2017
Because it doesn't change the world, because it returns the same result until it (the road network) is explicitly changed by something, because it can be cached.
Google search is GET
https://developers.google.com/custom-search/json-api/v1/using_rest
I realize that POST can always be used as a universal remote procedure call, but from what little I know about the "principled" web stuff, my impression is that this is a typical GET.
(at least the things which are fast enough that they return the result instantly, and don't need a "calculation job" as an extra resource to think about)
But perhaps it isn't so important.
And, of course, as soon as you start thinking about subscriptions to routes (so that you are pushed when road conditions change), then it's definitely a calculation job, true.
michaz commentedon May 13, 2017
+1 (At least from the software. From the service, I don't mind.)
Not only because security, but also because we are not a web framework.
I think in a few years we will say "Oh, you want our API a bit different? Go use a web tool to click together a proxy/gateway which changes it like you want it."
karussell commentedon May 13, 2017
I would argue against this (as real time road changes will invalidate this and it is unclear which routes to invalidate), but I think this is indeed discussible :)
Let me give you one "beauty" argument as why we shouldn't care much about principled web stuff here:
we'll be able to configure a CH vehicle profiles with a JSON file. Also the default vehicle profiles for non-CH should be configurable by JSON and now, we are forced due to beauty reasons ;), to use the same JSON to request our API to dynamically change the vehicle profile per request.
Yes, but then you could also argue about a resource that you subscribe to. BTW: navitia api is reeaally old ;)
michaz commentedon May 13, 2017
I'm not sure I understood whether you think this is good or bad.
So you want to use the same JSON description of a vehicle profile, no matter if you are
Correct?
Yeah, that sounds like a good thing.
michaz commentedon May 13, 2017
Or did you mean that we do not want this, because it would be overdoing it? But then I don't see the connection to POST with JSON, because then we can use JSON for configuring the pre-computation and URL parameters for the request and nobody cares.
karussell commentedon May 13, 2017
Yes, I meant this and I think this as a good thing :) There is also a third use case where you change defaults e.g. of car to toll=no or ferry=no etc.