# Javascript example not work

**URL:** <https://support.routexl.com/t/javascript-example-not-work/1299>\
**Category:** API\
**Created:** [March 11, 2020, 4:44pm UTC](https://support.routexl.com/t/javascript-example-not-work/1299 "2020-03-11T16:44:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![informatica3ALM](https://support.routexl.com/letter_avatar_proxy/v4/letter/i/4491bb/32.png) [@informatica3ALM](https://support.routexl.com/u/informatica3ALM)\
**Post date:** [March 11, 2020, 4:44pm UTC](https://support.routexl.com/t/javascript-example-not-work/1299/1 "2020-03-11T16:44:30Z")

</div>

Hi!

I have added the example in javascript in my code and when I run it, it gives me a url that answers an error 404. The url that is created is the following:

[https://api.routexl.nl/tour?locations[0][name]=1&locations[0][lat]=52.05429&locations[0][lng]=4.248618&locations[1][name]=2&locations[1][lat]=52.076892&locations[1][lng]=4.26975&locations[2][name]=3&locations[2][lat]=51.669946&locations[2][lng]=5.61852&locations[3][name]=4&locations[3][lat]=51.589548&locations[3][lng]=5.432482&locations[4][name]=5&locations[4][lat]=52.3702&locations[4][lng]=4.8951&locations[4][restrictions][ready]=10&locations[4][restrictions][due]=120](https://api.routexl.nl/tour?locations%5B0%5D%5Bname%5D=1&locations%5B0%5D%5Blat%5D=52.05429&locations%5B0%5D%5Blng%5D=4.248618&locations%5B1%5D%5Bname%5D=2&locations%5B1%5D%5Blat%5D=52.076892&locations%5B1%5D%5Blng%5D=4.26975&locations%5B2%5D%5Bname%5D=3&locations%5B2%5D%5Blat%5D=51.669946&locations%5B2%5D%5Blng%5D=5.61852&locations%5B3%5D%5Bname%5D=4&locations%5B3%5D%5Blat%5D=51.589548&locations%5B3%5D%5Blng%5D=5.432482&locations%5B4%5D%5Bname%5D=5&locations%5B4%5D%5Blat%5D=52.3702&locations%5B4%5D%5Blng%5D=4.8951&locations%5B4%5D%5Brestrictions%5D%5Bready%5D=10&locations%5B4%5D%5Brestrictions%5D%5Bdue%5D=120)

Can you help me please??

Thanks

---

<div class="post-metadata">

**Author:** ![RouteXL](https://support.routexl.com/user_avatar/support.routexl.com/routexl/32/347_2.png) [@RouteXL](https://support.routexl.com/u/RouteXL)\
**Post date:** [March 11, 2020, 6:18pm UTC](https://support.routexl.com/t/javascript-example-not-work/1299/2 "2020-03-11T18:18:15Z")

</div>

If you are getting a 404 you are probably not using POST to send the `/tour` request. Also note that `locations` should be a JSON encoded array. And, setting restrictions on the last location is not desirable. as the API considers the last location to be the finish point.

Please check the [Javascript example](https://github.com/routexl/RouteXL-API-Connector) at Github for more details.

---

<div class="post-metadata">

**Author:** ![informatica3ALM](https://support.routexl.com/letter_avatar_proxy/v4/letter/i/4491bb/32.png) [@informatica3ALM](https://support.routexl.com/u/informatica3ALM)\
**Post date:** [March 12, 2020, 10:23am UTC](https://support.routexl.com/t/javascript-example-not-work/1299/3 "2020-03-12T10:23:34Z")

</div>

> [@RouteXL](#):
>
> Also note that `locations` should be a JSON encoded array. And, setting restrictions on the last location is not desirable. as the API considers the last location to be the finish point.

We have tried the github example, and that is the result it gives us, error 404

---

<div class="post-metadata">

**Author:** ![RouteXL](https://support.routexl.com/user_avatar/support.routexl.com/routexl/32/347_2.png) [@RouteXL](https://support.routexl.com/u/RouteXL)\
**Post date:** [March 12, 2020, 1:05pm UTC](https://support.routexl.com/t/javascript-example-not-work/1299/4 "2020-03-12T13:05:57Z")

</div>

We’ve double checked the github example and that works for us:

> {“id”:“CO0909Hp”,“count”:5,“feasible”:false,“route”:{“0”:{“name”:“1”,“arrival”:0,“distance”:0},“1”:{“name”:“2”,“arrival”:5,“distance”:3.9},“2”:{“name”:“3”,“arrival”:87,“distance”:137.1},“3”:{“name”:“4”,“arrival”:105,“distance”:160.5},“4”:{“name”:“5”,“arrival”:179,“distance”:265.5}}}

Can you share full code so we can check that?
