Api tour error 403

Hello, we are testing the API service tour. but always get error 403 forbidden …
attached an example of failed request

POST https://api.routexl.nl/tour

locations = [{“address”, “Home”, “lat”: “- 34.6372982”, “lng”: “- 58.6583070”} {“address”, “work 136 260”, “lat”: “- 34.6473345” "lng “:” - 58.6594909 "}]

if instead send the sample data, it works …

locations = [{“address”, “Home”, “lat”: “52.05429”, “lng”: “4.248618”}, {“address”: “Work 1243”, “lat”: “52.076892”, “lng” “4.26975”}, {“address”: “work 1244”, “lat”: “51.669946”, “lng”: “5.61852”}, {“address”: “work 1245”, “lat”: “51.589548” “lng”: “5.432482”}]

as you can see, just change the values of lat and lng … (we used google maps geocoding for them)

Can’t check in detail at this moment, but the problem may indeed be input related. At first sight, your input has some errors. Most importantly, make sure locations and fields should be seperated by commas. Also don’t add spaces in coordinates, or just send them as values. In short, you may want to double check your data is valid JSON.

There is a comma missing between the two locations. It should be:

locations=[{"address":"Inicio","lat":"-34.6372982","lng":"-58.6583070"},{"address":"trabajo 136260","lat":"-34.6473345","lng":"-58.6594909"}]

You can check your input at http://jsonlint.com/. Make sure not to add “locations=” when validating.

No problem, it happens to the best :wink:

Happy coding!

You only have to add parameters to the points that have restrictions. There is no need to add those to all points.

The position of a point in the route will only change if the restriction is not met. Look at the arrival times in the output to check that. E.g. if the arrival of point A without restrictions would be a 50, it will not change with ready 20 and due 70.

As a side note: if conflicting restrictions are set, the problem is infeasible. That is, there is no route that meets all restrictions. In that case the routing algorithm will try to construct a route, but it will be missing some time windows.

From these examples we can not conclude if anything is wrong. If you’d like us to check what is happening, we’ll need the full input with all points.

Due and ready times should be in array “restrictions”:

locations=[{"address":"Inicio","lat":"-34.6372982","lng":"-58.6583070"},{"address":"136260","lat":"-34.6473345","lng":"-58.6594909"},{"address":"139102","lat":"-34.6194626","lng":"-58.8560844"},{"address":"139797","lat":"-34.6224208","lng":"-58.8430711"},{"address":"139848","lat":"-34.6419706","lng":"-58.8687726","restrictions":{"due":"50"}},{"address":"139319","lat":"-34.6037232","lng":"-58.3815931","restrictions":{"ready":"80"}},{"address":"139564","lat":"-34.6477986","lng":"-58.7902443"},{"address":"139301","lat":"-34.6550153","lng":"-58.7644323"},{"address":"135293","lat":"-34.6360397","lng":"-58.7523155"},{"address":"139030","lat":"-34.7055092","lng":"-58.7482414"}]

results to:

{    "id": "8tI6r4u7",    "count": 10,    "feasible": true,    "route": {        "0": {            "name": "Inicio",            "arrival": 0,            "distance": 0        },        "1": {            "name": "139797",            "arrival": 13,            "distance": 19.4        },        "2": {            "name": "139102",            "arrival": 16,            "distance": 21.1        },        "3": {            "name": "139848",            "arrival": 21,            "distance": 25.3        },        "4": {            "name": "139564",            "arrival": 29,            "distance": 33.8        },        "5": {            "name": "139301",            "arrival": 32,            "distance": 36.8        },        "6": {            "name": "135293",            "arrival": 37,            "distance": 40.8        },        "7": {            "name": "139319",            "arrival": 63,            "distance": 79.7        },        "8": {            "name": "136260",            "arrival": 102,            "distance": 111.1        },        "9": {            "name": "139030",            "arrival": 117,            "distance": 124.5        }    }}

Note that the optimizer here decides to wait at location 139319 from t=63 until the ready time t=80. Also note that this itinerary ends at location 139030. If you’d like to return to Inico after all work is done, you’ll need to add it as the final location again in your input.

Not at this moment. I’ll write it down for development but can not promise a time line.

You can’t at this moment. Only one time slot can be set right now…

Same as above, I’ll write it down for development but without any guarantees.

Good suggestion. I wil note it down for development. Thanks!

Yes, it should give an error message also.

We’ll add an overview of the responses to the API page.

The responses are added:

https://www.routexl.nl/blog/api/#response

Thanks for your time!.. I verify… i can’t see the errors…

this works!
locations=[{“address”:“Inicio”,“lat”:“52.05429”,“lng”:“4.248618”},{“address”:“trabajo 1243”,“lat”:“52.076892”,“lng”:“4.26975”},{“address”:“trabajo 1244”,“lat”:“51.669946”,“lng”:“5.61852”},{“address”:“trabajo 1245”,“lat”:“51.589548”,“lng”:“5.432482”}]

this don’t
locations=[{“address”:“Inicio”,“lat”:"-34.6372982",“lng”:"-58.6583070"}{“address”:“trabajo 136260”,“lat”:"-34.6473345",“lng”:"-58.6594909"}]

I check the data several times, I can not believe I have missed that …
thank you very much … and sorry for wasting your time.

Hi, I come back to bother with another topic …
I’m trying to use the ready and due parameters for visits, but I can’t see changes in the result.
Is it necessary to inform at all points of the tour or just the one with the restriction?

I use for example
{“address”:“139848”,“lat”:"-34.6419706",“lng”:"-58.8687726",“due”:“70”,“ready”:“20”}
or
{“address”:“139319”,“lat”:"-34.6037232",“lng”:"-58.3815931",“ready”:“80”}

but the position in the route is not changed

thanks in advance

Thanks … I think I have considered that … in the first tests I did send a number of data without restrictions:

locations=[{“address”:“Inicio”,“lat”:"-34.6372982",“lng”:"-58.6583070"},
{“address”:“136260”,“lat”:"-34.6473345",“lng”:"-58.6594909"},
{“address”:“139102”,“lat”:"-34.6194626",“lng”:"-58.8560844"},
{“address”:“139797”,“lat”:"-34.6224208",“lng”:"-58.8430711"},
{“address”:“139848”,“lat”:"-34.6419706",“lng”:"-58.8687726"},
{“address”:“139319”,“lat”:"-34.6037232",“lng”:"-58.3815931"},
{“address”:“139564”,“lat”:"-34.6477986",“lng”:"-58.7902443"},
{“address”:“139301”,“lat”:"-34.6550153",“lng”:"-58.7644323"},
{“address”:“135293”,“lat”:"-34.6360397",“lng”:"-58.7523155"},
{“address”:“139030”,“lat”:"-34.7055092",“lng”:"-58.7482414"}]

and got these results:
{    “id”: “5nmj4115”,    “count”: 10,    “feasible”: true,
    “route”: {
        “0”: {“name”: “Inicio”,    “arrival”: 0,  “distance”: 0       },
        “1”: {“name”: “136260”,“arrival”: 2,  “distance”: 1.5    },
        “2”: {“name”: “139319”,“arrival”: 24,“distance”: 32.9  },
        “3”: {“name”: “135293”,“arrival”: 52,“distance”: 72.5  },
        “4”: {“name”: “139797”,“arrival”: 60,“distance”: 82.1  },
        “5”: {“name”: “139102”,“arrival”: 64,“distance”: 83.8  },
        “6”: {“name”: “139848”,“arrival”: 68,“distance”: 88     },
        “7”: {“name”: “139564”,“arrival”: 77,“distance”: 96.5  },
        “8”: {“name”: “139301”,“arrival”: 80,“distance”: 99.5  },
        “9”: {“name”: “139030”,“arrival”: 90,“distance”: 107.9}
    }
}

then put restrictions at the named point “139319”, which has arrived in 24 to ready after 80 and the named point “139848” that has arrived in 68 to have a due on 50

locations=[{“address”:“Inicio”,“lat”:"-34.6372982",“lng”:"-58.6583070"},
{“address”:“136260”,“lat”:"-34.6473345",“lng”:"-58.6594909"},
{“address”:“139102”,“lat”:"-34.6194626",“lng”:"-58.8560844"},
{“address”:“139797”,“lat”:"-34.6224208",“lng”:"-58.8430711"},
{“address”:“139848”,“lat”:"-34.6419706",“lng”:"-58.8687726",“due”:“50”},
{“address”:“139319”,“lat”:"-34.6037232",“lng”:"-58.3815931",“ready”:“80”},
{“address”:“139564”,“lat”:"-34.6477986",“lng”:"-58.7902443"},
{“address”:“139301”,“lat”:"-34.6550153",“lng”:"-58.7644323"},
{“address”:“135293”,“lat”:"-34.6360397",“lng”:"-58.7523155"},
{“address”:“139030”,“lat”:"-34.7055092",“lng”:"-58.7482414"}]

with these restrictions expect any change in the route, but got the same results

thank you very much … I appreciate your response.
we will continue with the tests …

Is it possible to add a pause during the tour?
for example, you must stop between 13:00 and 14: 00hs for lunch … no matter where … but note that time for due and ready for the next step …
In principle, it occurs to me to generate a first full tour and extend the “servicetime” of the last stop before the lunchtime …  and then recalculate the route …
Is there another way?

Another …
if you have to visit a point between a ready and due … for example between 15 and 16hrs … if the tour starts at 10am … I use “ready: 300” and "due: 360 "… OK! … but if I can see that point at any time, exept from 15 to 16hrs … what should I use?

Thanks … I think allowing multiple timeslots (due / ready) in restrictions array, can be solved both issues.

Is there not another response code that can be added into the api for malformed json.

What about:: 409 Conflict

The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request.

Snipped the rest as but it can be found here: 

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html