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();
}
}