# Testing API POST does not work

**URL:** <https://support.routexl.com/t/testing-api-post-does-not-work/1217>\
**Category:** API\
**Created:** [January 16, 2020, 9:26am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217 "2020-01-16T09:26:53Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 16, 2020, 9:26am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/1 "2020-01-16T09:26:53Z")

</div>

Hi,  
I´m testing the API from a console applicarion using C#.  
The GET method works fine I got the request bak from Hello World.  
POST tour method does not work for me when testing with the example you are providing, is the format of the postData incorret or something else?  
I´m getting error code (400) here is my code:

* * *

```
        string strUrl = string.Format("https://api.routexl.com");
        WebRequest requestObjPost = WebRequest.Create(strUrl);
        requestObjPost.Method = "POSTr";
        requestObjPost.Credentials = new NetworkCredential(userName, passWord);
        requestObjPost.ContentType = "application/json";
        string postData = "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\"}]";

        using (var streamWriter = new StreamWriter(requestObjPost.GetRequestStream()))
        {
            streamWriter.Write(postData);
            streamWriter.Flush();
            streamWriter.Close();

            var httpRespose = (HttpWebResponse)requestObjPost.GetResponse();

            using (var streamReader = new StreamReader(httpRespose.GetResponseStream()))
            {
                var JSonresult = streamReader.ReadToEnd();
            }
        }

```

* * *

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 16, 2020, 10:08am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/2 "2020-01-16T10:08:37Z")

</div>

I corrected Method to POST and now I´m getting error (404) not found

---

<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:** [January 16, 2020, 10:15am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/3 "2020-01-16T10:15:31Z")

</div>

We’re no C# programmers, but you may want to try these adjustments:

1. `strUrl = string.Format("https://api.routexl.com/tour")`
2. `requestObjPost.Method = "POST"` (without the trailing `r`)
3. `requestObjPost.ContentType = "application/x-www-form-urlencoded"`

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 16, 2020, 10:20am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/4 "2020-01-16T10:20:16Z")

</div>

works fine I´m getting the result, thanks for the quick respons!

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 18, 2020, 8:00am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/5 "2020-01-18T08:00:58Z")

</div>

The example your are providing for the tour is not a valid JSON when validated on [https://jsonlint.com/](https://jsonlint.com/)  
please check it.

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”  
}]

---

<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:** [January 18, 2020, 10:43am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/6 "2020-01-18T10:43:45Z")

</div>

![41](https://support.routexl.com/uploads/default/original/1X/7cef0c06915fdebc0427d743a6dc2ce4aeddf3f1.png)

It seems to validate fine. Can you double check?

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 21, 2020, 2:26pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/7 "2020-01-21T14:26:53Z")

</div>

It validates when editing the string, copy/paste does not work.  
Now I´m working with som other test data from the real world but I get error 409, bellow is the locations I´m posting:

locations =[{“address”: “10002”, “lat”: “59,4791843”, “lng”: “18,3013905”}, {“address”: “10091”, “lat”: “59,3071596”, “lng”: “18,0725852”}, {“address”: “10113”, “lat”: “59,7973677”, “lng”: “17,4435512”}, {“address”: “10113”, “lat”: “59,7973677”, “lng”: “17,4435512”}, {“address”: “10230”, “lat”: “59,2”, “lng”: “17,7333”}, {“address”: “10251”, “lat”: “59,4446719”, “lng”: “18,0214225”}, {“address”: “10260”, “lat”: “59,8585”, “lng”: “17,6454”}, {“address”: “10260”, “lat”: “59,8585”, “lng”: “17,6454”}, {“address”: “10325”, “lat”: “59,56325”, “lng”: “18,24031”}, {“address”: “10331”, “lat”: “59,8585816”, “lng”: “17,6389246”}, {“address”: “10361”, “lat”: “59,5152204”, “lng”: “18,0908499”}, {“address”: “10458”, “lat”: “59,4695535”, “lng”: “18,3073016”}, {“address”: “10468”, “lat”: “59,8610119”, “lng”: “17,4367243”}, {“address”: “10498”, “lat”: “61,3838898”, “lng”: “15,8124737”}, {“address”: “10516”, “lat”: “59,8459562”, “lng”: “17,5923106”}, {“address”: “10572”, “lat”: “59,2847953”, “lng”: “17,9933598”}, {“address”: “10680”, “lat”: “59,5122484”, “lng”: “17,6532968”}, {“address”: “10743”, “lat”: “59,14972”, “lng”: “18,11667”}, {“address”: “10759”, “lat”: “60,03004”, “lng”: “17,55203”}, {“address”: “10782”, “lat”: “59,1726697”, “lng”: “18,1685527”}, {“address”: “10782”, “lat”: “59.1726697”, “lng”: “18.1685527”}]

---

<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:** [January 21, 2020, 2:49pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/8 "2020-01-21T14:49:48Z")

</div>

1. Copying the string can have a side-effect. It may change the quote character, e.g. `"xxx"` to `“xxx”`. This effectively makes the string no longer validate as JSON.

2. In your locations many `lat` and `lng` values are formatted as numbers with a comma as decimal seperator. Our API expects a dot as decimal seperator.

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 21, 2020, 4:18pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/9 "2020-01-21T16:18:56Z")

</div>

Now all records has dot as decimal separator instead of comma, but still gertting error (409 - Conflict) bellow is the post string:

locations =[{“address”: “10002”, “lat”: “59.4791843”, “lng”: “18.3013905”}, {“address”: “10091”, “lat”: “59.3071596”, “lng”: “18.0725852”}, {“address”: “10113”, “lat”: “59.7973677”, “lng”: “17.4435512”}, {“address”: “10113”, “lat”: “59.7973677”, “lng”: “17.4435512”}, {“address”: “10230”, “lat”: “59.2”, “lng”: “17.7333”}, {“address”: “10251”, “lat”: “59.4446719”, “lng”: “18.0214225”}, {“address”: “10260”, “lat”: “59.8585”, “lng”: “17.6454”}, {“address”: “10260”, “lat”: “59.8585”, “lng”: “17.6454”}, {“address”: “10325”, “lat”: “59.56325”, “lng”: “18.24031”}, {“address”: “10331”, “lat”: “59.8585816”, “lng”: “17.6389246”}, {“address”: “10361”, “lat”: “59.5152204”, “lng”: “18.0908499”}, {“address”: “10458”, “lat”: “59.4695535”, “lng”: “18.3073016”}, {“address”: “10468”, “lat”: “59.8610119”, “lng”: “17.4367243”}, {“address”: “10498”, “lat”: “61.3838898”, “lng”: “15.8124737”}, {“address”: “10516”, “lat”: “59.8459562”, “lng”: “17.5923106”}, {“address”: “10572”, “lat”: “59.2847953”, “lng”: “17.9933598”}, {“address”: “10680”, “lat”: “59.5122484”, “lng”: “17.6532968”}, {“address”: “10743”, “lat”: “59.14972”, “lng”: “18.11667”}, {“address”: “10759”, “lat”: “60.03004”, “lng”: “17.55203”}, {“address”: “10782”, “lat”: “59.1726697”, “lng”: “18.1685527”}, {“address”: “10782”, “lat”: “59.1726697”, “lng”: “18.1685527”}]

---

<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:** [January 21, 2020, 4:41pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/10 "2020-01-21T16:41:00Z")

</div>

When we copy the locations and replace the curly quotes with straight ones, we can get a route in Postman without any problem:

 ![postman](https://support.routexl.com/uploads/default/original/1X/2515bef4a8e4cf802e4d5e2812bddd04257c26ba.png)

If you share your code or a screenshot here, we can check in more detail.

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 21, 2020, 4:49pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/11 "2020-01-21T16:49:42Z")

</div>

When dubugging In the C# code the variable routeData string has the straight quotes 🙂

 ![image](https://support.routexl.com/uploads/default/original/1X/cfca376beecec53f5032af48777f7382b77f2e6f.png)

---

<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:** [January 21, 2020, 7:36pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/12 "2020-01-21T19:36:31Z")

</div>

Try without the space after the locations key:

`string routeData = "locations=[";`

Also, check your previous code is now:

`streamWriter.Write(routeData);`

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 21, 2020, 8:22pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/13 "2020-01-21T20:22:03Z")

</div>

Lastly I was able to get a correct response but it does not work when I send a request with 20 adresses, my subscription is today the free acount which supports upp to 20 stops per route, I´m able to send only 10???

![image](https://support.routexl.com/uploads/default/original/1X/759f0e6be4cfd0c9915dbb8a011c589694716a53.png)

---

<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:** [January 21, 2020, 8:50pm UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/14 "2020-01-21T20:50:19Z")

</div>

The API is indeed limited to 10 locations for the free users. That’s mentioned on the same page.

And, we also have a [fair use policy](https://wiki.routexl.com/index.php?title=Fair_Use_Policy).

---

<div class="post-metadata">

**Author:** ![AutoLinkRouteXL](https://support.routexl.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@AutoLinkRouteXL](https://support.routexl.com/u/AutoLinkRouteXL)\
**Post date:** [January 22, 2020, 11:42am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/15 "2020-01-22T11:42:47Z")

</div>

I choosed to evaluate RouteXL when I saw in the pricing page that it supports up to 20 stops per route and woul like my free subscription to support that number of stops under the project developement

---

<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:** [January 22, 2020, 11:45am UTC](https://support.routexl.com/t/testing-api-post-does-not-work/1217/16 "2020-01-22T11:45:22Z")

</div>

The website has 20 locations and the API has max 10 locations in the free plan, as stated on the pricing page. If you need more locations per route, you’ll need to upgrade your account.
