Not getting the expected API response for /tour

I’m working on integrating the RouteXL API into a PHP web application for a client but I’m running into problems when trying to get a route.

When I post to the tour page I’m getting one of the following responses (I’ve tried it with the application data and example on the website):

200 with body text "Another route in progress"
409 "No input found:"
403 Could not create new tour

Never am I getting the expected response with a route in it. The data I’ve tried using is the following:

// example datalocations=[{"address":"The Hague, The Netherlands","years":"52.05429","lng":"4.248618"},{"address":"The Hague, The Netherlands","years":"52.076892","lng":"4.26975"},{"address":"Without, The Netherlands","years":"51.669946","lng":"5.61852"},{"address":"St. Oedenrode, The Netherlands","years":"51.589548","lng":"5.432482"}]

 // application data locations=[{"address":"Kampstraat 10, Appeltern","lat":"51.8339045","lon":"5.585008"},{"address":"Kamillestraat 13, Den Dungen","lat":"51.6633025","lon":"5.3784988"},{"address":"Ketelstraat 13, Ulft","lat":"51.8977718","lon":"6.3766429"},{"address":"Kamillestraat 13, Den Dungen","lat":"51.6633025","lon":"5.3784988"}]

The translation plugin really scrambles the examples on the API documentation page.

Use this format:

locations=[{"address":"The Hague, The Netherlands","lat":"52.05429","lng":"4.248618"},{"address":"The Hague, The Netherlands","lat":"52.076892","lng":"4.26975"},{"address":"Uden, The Netherlands","lat":"51.669946","lng":"5.61852"},{"address":"Sint-Oedenrode, The Netherlands","lat":"51.589548","lng":"5.432482"}]


Don’t focus on the address, the coordinates were the problem. In the first example data you had years,lng  (years is wrong) and in the second application data lat,lon  (lon is wrong). It must be lat,lng.

The address does not need to be formatted for the API. The coordinates are used to find the best route. You can use the address field as the ID. You could even just use numbers.

Okay, I’ve got it fixed now. I now understand every address should end with “, Country Name” and I had lon instead of lng.

Okay, I’ve got it working now with the data I want. Thanks for the help!

Hey, are lat&lng mandatory parameters?