Error: Page not found

I’m very new with RouteXL and with programming but try to conect my CMS with RouteXL to generate a route by walking to different points in one city by using the API.

Now I have two problems but unfortunately I’m not able to resolve them without outside help:

  1. It is necessary to set the options parameters (Type of vehicle = “Foot” and Search area = “M”).
    I think I have to use the API-Solution V2 like: “https://api.routexl.com/v2/tour” an add the parameters like: “data: { locations:locations, parameters:{‘type’:‘foot’, ‘seachaerea’:‘M’}”. Is that correct and what else I have to do?

  2. I have changed these points like above in the “Javascript/RouteXL-API-Connector” and tryed various way to process the Json results and generate HTML to that the route will be correctly shown - unfortunately without success. I always get the error message: “404 Page Not Found”

Maybe there is a user with his solution as an example for me, how to process the Json results first and generate HTML with or without V2 ?

Thanks for your response!

  1. Search area is not supported in the API, only on the website. The API does not have geocoding, it consumes coordinates instead of addresses.

  2. Did you test the URL in a browser? If so, you normally GET the request. But the /tour call requires a POST. To POST in a web page you could use a form, like this:

<form action="https://api.routexl.com/v2/tour" method="post" target="_blank"> <input name="locations" type="hidden" value="[{'name':'The Hague, The Netherlands','lat':'52.05429','lng':'4.248618'},{'name':'The Hague, The Netherlands','lat':'52.076892','lng':'4.26975'},{'name':'Uden, The Netherlands','lat':'51.669946','lng':'5.61852'},{'name':'Sint-Oedenrode, The Netherlands','lat':'51.589548','lng':'5.432482'}]" /> <input type="submit" value="Show" /></form>

Thank you for your quick answer.

I have already tried a version with <form action …>.
But everytime first, it pop-up a the challenge box asking for my username / password, but this is not meaningful for extraneous users and I should already be logged in via my request before.

If I enter password and username manually and enter also exactly your sample data, I still get only the message:
No locations: [{‘name’: ‘The Hague, The Netherlands’, ‘lat’: ‘52.05429’, ‘lng’: ‘4.248618’}, {‘name’: ‘The Hague, The Netherlands’, ‘lat’ : ‘52 .076892 ‘,’ lng ‘:’ 4.26975 ‘}, {’ name ‘:’ Uden, The Netherlands ‘,’ lat ‘:’ 51.669946 ‘,’ lng ‘:’ 5.61852 ‘}, {’ name ‘:’ Sint -Oedenrode, The Netherlands’, ‘lat’: ‘51.589548’, ‘lng’: ‘5.432482’}]
and on the console:
Failed to load resource: the server responded with a status of 409 (Conflict) tour: 1

I have specially built a test page in which this can be seen (and I also changed the password for the moment for this purpose to “Modallorca”):
http://aprico24.cms4all.info/76

In the application itself (so far only test pages) the optimized route should open by clicking on the button “Routenberechnung jetzt erstellen” (“Make route calculation now”). But for that I’ve no solution, because additions like your example will not be accepted.
I tried to solve this with curl too, but the result is the same. Look at this page:
http://aprico24.cms4all.info/portal/22/75/tiendassantanyi/d-tres-moda?portal_id=16&peid=22&q=&next=38,42,30,e&previous=9,s&qid=&p=&location_id=75
I get the message:
Failed to load resource: the server responded with a status of 404 (Not Found) tour: 1

The trial will run at “http” instead of “https”. Can that lead to the conflict?
Or what else I’m doing wrong?

Our bad, the locations should not have quotes. Please try again with this:

<form action="https://api.routexl.com/v2/tour" method="post" target="_blank"><input name="locations" type="hidden" value="[{&quot;name&quot;:&quot;The Hague, The Netherlands&quot;,&quot;lat&quot;:&quot;52.05429&quot;,&quot;lng&quot;:&quot;4.248618&quot;},{&quot;name&quot;:&quot;The Hague, The Netherlands&quot;,&quot;lat&quot;:&quot;52.076892&quot;,&quot;lng&quot;:&quot;4.26975&quot;},{&quot;name&quot;:&quot;Uden, The Netherlands&quot;,&quot;lat&quot;:&quot;51.669946&quot;,&quot;lng&quot;:&quot;5.61852&quot;},{&quot;name&quot;:&quot;Sint-Oedenrode, The Netherlands&quot;,&quot;lat&quot;:&quot;51.589548&quot;,&quot;lng&quot;:&quot;5.432482&quot;}]" /> <input type="submit" value="Show" /></form>

Now I get the JSON data displayed as before too, but no RouteXL page with the route itself.

What have I to do to proceed the Json results and generate HTML to that the route will be correctly shown? See my first questions (point 2).

And the difference between http and https does not matter?

Our API does not generate maps, only the reordered locations. To create a map with the results, you can use a framework like Leaflet, which is also used on our website. See: https://leafletjs.com/

There is no other difference in result between http and https but the connection, the communication will be encrypted and more secure.