Search code examples
xamarinflaskgetjsonrestsharp

Xamarin + RestSharp request returning empty JSON


I'm trying to get JSON from Flask-RESTful API but instead of:

  [
   [
    {
      "c_t": [],
      "imie": "test",
      "login": "test2",
      "nazwisko": "test3",
      "oferty": [],
      "password": "passpass",
      "user_id": 13,
      "u_t": []
    }
  ],
  {}
]

I'm getting empty string as response.Content. Here is my code:

var client = new RestClient("https://SERVER-IP");
var request = new RestRequest("/users", Method.GET);

request.AddHeader("Content-Type", "application/json");

client.ExecuteAsync(request, response =>
{
 RunOnUiThread(delegate
 {
    var responseC = response.Content;

    Toast.MakeText(this, responseC, Toast.Length.Long).Show();
 });
});

Solution

  • Use http instead of https ;) This is what fixed it for us.