Connecting to local server via swagger

Hi, I’ve generate the java client from here
https://editor.swagger.io/?url=https://docs.graphhopper.com/openapi.json

Now I’m trying to make a routeAsync call. Each time it tells me {“code”:400,“message”:“query param point is invalid: Cannot parse point ‘[-76.87247117180661,38.82279018066801]’”}

as far as I can tell, this is the format it seems to expect.

I get this regardless of whether I’m talking to the official Graphhopper server, or to my local server. Any advice would be welcome.

Here’s the arguments I’m passing in.

api.getRouteAsync(Arrays.asList("[" + start.getLongitude() + “,” + start.getLatitude() + “]”,
“[” + end.getLongitude() + ‘,’ + end.getLatitude() + ‘]’),
“car”,
Collections.emptyList(),
Collections.emptyList(),
Collections.emptyList(),
“en”,
false,
Collections.emptyList(),
“false”, false,
true,
true,
false,
false,
Collections.emptyList(),
120,
false,
“”,
1000,
0l,
2,
new BigDecimal(1.4),
new BigDecimal(.6), new ApiCallback() {

Try this instead:

api.getRoute(Arrays.asList("38.82,-76.87", "39.82,-77.87")

Note that there are no square brackets and for each point the first number is the latitude not the longitude. This is different between the GET /route endpoint and the POST /route endpoint! Also I used getRoute instead of getRouteAsync.

Thank you, that did the trick!

Powered by Discourse