# \[closed\] Call Tour API with C# and RestSharp return empty content

**URL:** <https://support.routexl.com/t/closed-call-tour-api-with-c-and-restsharp-return-empty-content/1215>\
**Category:** API\
**Created:** [January 15, 2020, 3:43pm UTC](https://support.routexl.com/t/closed-call-tour-api-with-c-and-restsharp-return-empty-content/1215 "2020-01-15T15:43:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mastrodascioh501](https://support.routexl.com/letter_avatar_proxy/v4/letter/m/67e7ee/32.png) [@mastrodascioh501](https://support.routexl.com/u/mastrodascioh501)\
**Post date:** [January 15, 2020, 3:43pm UTC](https://support.routexl.com/t/closed-call-tour-api-with-c-and-restsharp-return-empty-content/1215/1 "2020-01-15T15:43:53Z")

</div>

Hi,

I have an application that uses the \* tour \* API to optimize my journey. In the beginning it worked very well but now the result of the API call \* tour \* is empty content.

I haven’t changed anything from the initial code.

This is my code in C# to call the _tour_ API (I use RestSharp)  
public class LocationRouteXl  
{  
public String name { get; set; }  
public String lat { get; set; }  
public String lng { get; set; }  
public Int32 servicetime { get; set; }  
}

```
var list = new List<LocationRouteXl>()
{
new LocationRouteXl() { lat="41.901202", lng="12.499968", name="Start", servicetime=0 }, 
new LocationRouteXl() { lat="41.901571", lng="12.459103", name="49491", servicetime=60 },
new LocationRouteXl() { lat="41.901202", lng="12.499968", name="End", servicetime=0 }
});   
String json = JsonConvert.SerializeObject(list);
RestRequest request = new RestRequest("tour", Method.POST);
request.AddHeader("Authorization", "Basic " + auth);
request.AddHeader("Accept", @"application\json");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");

request.AddParameter("locations", json, ParameterType.GetOrPost);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

```

The problem is that _response.Content_ is always empty and response.ErrorMessage is ‘Underlying connection closed: Unexpected error during a send operation’.

I tried also with postman and is working well, i tred also the code that automatically generate for C# and restsharp

var client = new RestClient(“[https://api.routexl.com/tour](https://api.routexl.com/tour)”);  
client.Timeout = -1;  
var request = new RestRequest(Method.POST);  
request.AddHeader(“Authorization”, “Basic xxx”);  
request.AddHeader(“Content-Type”, “application/x-www-form-urlencoded”);  
request.AddHeader(“Content-Type”, “multipart/form-data; boundary=--------------------------219123338859153648958175”);  
request.AlwaysMultipartFormData = true;  
request.AddParameter(“locations”, “[{“name”:“Start”,“lat”:“41.901202”,“lng”:“12.499968”,“servicetime”:0,“restrictions”:null},{“name”:“49390”,“lat”:“41.901571”,“lng”:“12.459103”,“servicetime”:60,“restrictions”:null},{“name”:“End”,“lat”:“41.901202”,“lng”:“12.499968”,“servicetime”:0,“restrictions”:null}]”);  
IRestResponse response = client.Execute(request);  
Console.WriteLine(response.Content);

But return always empty string as content.

Any help?  
Thank you

---

<div class="post-metadata">

**Author:** ![mastrodascioh501](https://support.routexl.com/letter_avatar_proxy/v4/letter/m/67e7ee/32.png) [@mastrodascioh501](https://support.routexl.com/u/mastrodascioh501)\
**Post date:** [January 15, 2020, 4:25pm UTC](https://support.routexl.com/t/closed-call-tour-api-with-c-and-restsharp-return-empty-content/1215/2 "2020-01-15T16:25:53Z")

</div>

I solved it by setting .net 4.6 in the project.
