Esempio n. 1
0
 public Test()
 {
     root = new Rootobject();
 }
Esempio n. 2
0
        public string RequestByName()
        {
            string name = "soghetsu";
            string region = "LAS";
            Rootobject root = new Rootobject();

            // URL Request
            string apiKey = "fbfa3c47-9c26-4891-8e55-c50a4f3ad3ba";
            string uri = "https://na.api.pvp.net/api/lol/" + region.ToString() + "/v1.4/summoner/by-name/";
            string adds = name + "?api_key=" + apiKey;

            // Get JSON response from server
            HttpClient client = new HttpClient();
            client.BaseAddress = new Uri(uri);
            var response = client.GetAsync(adds).Result;

            // Convert to object
            var responseJson = response.Content.ReadAsStringAsync().Result;
            root = JsonConvert.DeserializeObject<Rootobject>(responseJson);
            //name = root.soghetsu.name
            return (root.soghetsu.name);
        }
Esempio n. 3
0
 public Test()
 {
     root = new Rootobject();
 }