6

I'm trying to fetch data in "xamarin studio" using "rest sharp" package like so:

var client = new RestClient ("https://xxxx.xxxx.com");

var request = new RestRequest ("/api/external/xxxx/xxxx/", Method.GET);
request.AddParameter("username", "xxxx");
request.AddParameter("api_key", "xxxx");

request.AddHeader("Content-type", "application/json");      
request.AddHeader("Accept", "text/plain");

request.RequestFormat = DataFormat.Json;

var response = client.Execute (request);

var model = JsonConvert.DeserializeObject<RootObject> (response.Content);

The error I get is

Error: SendFailure (Error writing headers)

I really don't know what is wrong. I'm using windows 7 64-bit.

Please help... Thank you for advance!!!

Kristijan Iliev
  • 4,901
  • 10
  • 28
  • 47
Vladi Isakov
  • 289
  • 6
  • 16
  • Has to do with Certificates being out of synch. Linux based solution: http://stackoverflow.com/questions/25081384/mono-httpwebrequest-over-ssl-error-writing-headers – Jefferey Cave Dec 21 '14 at 18:20

1 Answers1

1

This is likely due to certificate errors. Can you test using straight HTTP? Or set your app to ignore certificate checks as described here.

Community
  • 1
  • 1
bbsimonbb
  • 27,056
  • 15
  • 80
  • 110