Forum Xamarin.Android

RestSharp error when accessing properties from the response object

JehanJehan USMember

I am using the trial version of Xamarin Studio and am trying to make a simple rest call.
I added the restsharp component and I am unable to access properties on the response.
My code works on a normal .Net console app, but it blows up on Xamarin. My code is below.
Any thoughts?

var restClient = new RestClient("https://dev/CatalogService/api");

        var request = new RestRequest("productlist", Method.GET);

        request.AddParameter("priorityCode", "DEFAULT");
        request.AddParameter("categoryId", 0);
        request.AddParameter("contractTypeId", 2);// adds to POST or URL querystring based on Method  callback
        request.AddParameter("callback", 1);
        //request.AddUrlSegment("id", 123); // replaces matching token in request.Resource

        // easily add HTTP Headers

        var response = restClient.Execute(request);
        var content = response.ContentLength; 


Sign In or Register to comment.