Esempio n. 1
0
        /// <summary>
        /// MUST MAKE POST REQUEST
        /// </summary>
        public void makeWebRequest(string endPoint, string requestUrl)
        {
            var client  = new RestClient(endPoint);
            var request = new RestRequest(requestUrl, Method.POST);

            // Automatically deserialize result
            IRestResponse <StarWarsObject> response2 = client.Execute <StarWarsObject>(request);

            _starWarsObject = response2.Data;
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieve JSON data from http request
        /// </summary>
        public void makeStarWarsWebRequest()
        {
            var client  = new RestClient("http://swapi.co/api/");
            var request = new RestRequest("people/1", Method.GET);

            // Automatically deserialize result
            IRestResponse <StarWarsObject> response2 = client.Execute <StarWarsObject>(request);

            _starWarsObject = response2.Data;
        }