public void TestMethod() { string player = "Blacklistedrnd"; string player2 = "ThirdSiege"; string token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2NDJlNGI1MC05NjhmLTAxMzYtOWU0OS0wYTU4NjQ2MGZlYWQiLCJpc3MiOiJnYW1lbG9ja2VyIiwiaWF0IjoxNTM2NTE5MTM0LCJwdWIiOiJzZW1jIiwidGl0bGUiOiJ2YWluZ2xvcnkiLCJhcHAiOiJ0ZXN0c2RrIiwic2NvcGUiOiJjb21tdW5pdHkiLCJsaW1pdCI6MTB9.BNcA0qSiNnWgTZ3T23osZfiIj2HHG_ZMCieMQmWpTVA"; //Bearer //HttpClient client = new HttpClient(); //client.BaseAddress = new Uri($"https://api.dc01.gamelockerapp.com/shards/na/players?filter[playerNames]={player}"); //client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); //client.DefaultRequestHeaders.Add("Accept", "application/vnd.api+json"); //var shard = new ShardId().GetDescription(ShardId.Shard.NorthAmerica); using (var client = new HttpClient()) { var urlPlayer = $"https://api.dc01.gamelockerapp.com/shards/na/players?filter[playerNames]={player},{player2}"; var url = $"https://api.dc01.gamelockerapp.com/shards/na/matches/030bf701-41a2-41f0-929b-3a8ae7f268e2"; client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); client.DefaultRequestHeaders.Add("Accept", "application/vnd.api+json"); var response = client.GetAsync(url).Result;//.GetStringAsync(url); if (response.IsSuccessStatusCode) { var result = response.Content.ReadAsStringAsync().Result; //var players = PlayerData.FromJson(result); var matches = MatchData.FromJson(result); } } }
public MatchData GetMatch() { MatchData match = null; var shardId = GetShardDescription(shard); var matchUrl = $"{APIUrl}{shardId}{MatchesEndpoint}"; var result = GetApiJsonResponse(matchUrl); match = MatchData.FromJson(result); return(match); }