Hi,
Since a few days, if I try to use my javascript-code to get an isochrone, the server returns an http-406, with the following content:
{
"error":
{
"code":3007,
"message":"This response format is not supported"
},
"info":{"engine":{"build_date":"2024-03-21T13:55:54Z","version":"8.0.0"},"timestamp":1715245629980}}
The request is a POST to https://api.openrouteservice.org/v2/isochrones/driving-car/, the post body is the following Json:
{
"locations":[[4.927085,52.891825]],
"range":[1800],
"range_type":"time"
}
If I try the post-body in the API Playground, I get the expected response, ie. an isochrone, so the problem does not seem to stem from the post-body. Since mozilla’s http error code documentation suggests this has to do with the Accept-headers, I thought I’d try a few things there.
I’ve tried the following Accept-headers (using both Chrome and Firefox):
xhr.setRequestHeader('Accept', 'application/geo+json');
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('Accept', '');
xhr.setRequestHeader('Accept', 'text/plain');
and I’ve tried NOT setting any Accept-headers, in which case the browser sets it to Accept: /,
but all of those return the same http-406 with error-code 3007. 406 is not documented, 3007 IS documented, but not with a very helpful explanation:
3007 Unsupported export format.
As suggested by the mozilla documentation for 406, the body of the message should contain the list of the available representations of the resources, allowing the user to choose among them. But that is not the case, so I have no idea what should be in the Accept headers (note that browsers (at least Firefox) do not allow you to change the Accept-Encoding header…).
This only seems to happen with Isochrones, the route- and poi-implementations that I wrote (which use the same underlying code) still work without any problems. It’s only the isochrones that show this behavior.
What do I need to set in the Accept-headers in order to get a proper response, any ideas?
Edit: Had a look at the API playground headers that are being used. The Accept-header had as contents application/json, text/plain, */*
, so I changed my Accept header to that: no difference. The only difference in headers is in the Origin and Referer headers for as far as I can see, so that shouldn’t make a difference I would think (at least, it shouldn’t cause the 406-3007…). And the exact same thing happens on Opera for Android as well, so it does not seem to be related to browsers or laptop.