C
C#•3w ago
Nick Eh Likes 15

requesting not working on windows 10 ONLY windows 11 works fine

This is a short snippet of my code, pretty simple, uses a api and whatever. But no url works at all so its not just this url its any and also any windows 10 pc i have tried spits out the same issue
private static async Task<List<Dictionary<string, object>>> GetPlayerDataAsync(List<int> ids)
{
string playersApi = "https://api.rec.net/api/players/v2/progression/bulk";

try
{
string queryString = string.Join("&", ids.Select(id => $"id={id}"));
string requestUrl = $"{playersApi}?{queryString}";

var request = new HttpRequestMessage
{
RequestUri = new Uri(requestUrl),
Method = HttpMethod.Get,
};
request.Headers.Add("Accept", "*/*");

HttpResponseMessage response = await client.SendAsync(request);

if (response.IsSuccessStatusCode)
{
string responseContent = await response.Content.ReadAsStringAsync();
List<Dictionary<string, object>> data = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(responseContent);
return data;
}
else
{
Console.WriteLine($"Error retrieving player data: {response.StatusCode}");
return null;
}
}
catch (Exception e)
{
Console.WriteLine($"Request Error: {e.Message}");
return null;
}
}
private static async Task<List<Dictionary<string, object>>> GetPlayerDataAsync(List<int> ids)
{
string playersApi = "https://api.rec.net/api/players/v2/progression/bulk";

try
{
string queryString = string.Join("&", ids.Select(id => $"id={id}"));
string requestUrl = $"{playersApi}?{queryString}";

var request = new HttpRequestMessage
{
RequestUri = new Uri(requestUrl),
Method = HttpMethod.Get,
};
request.Headers.Add("Accept", "*/*");

HttpResponseMessage response = await client.SendAsync(request);

if (response.IsSuccessStatusCode)
{
string responseContent = await response.Content.ReadAsStringAsync();
List<Dictionary<string, object>> data = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(responseContent);
return data;
}
else
{
Console.WriteLine($"Error retrieving player data: {response.StatusCode}");
return null;
}
}
catch (Exception e)
{
Console.WriteLine($"Request Error: {e.Message}");
return null;
}
}
No description
7 Replies
Nick Eh Likes 15
Nick Eh Likes 15OP•3w ago
this is my issue as shown in the ss above
Angius
Angius•3w ago
JsonConvert.DeserializeObject<List<Dictionary<string, object>>> 💀 Regardless, it's the server telling you you're forbidden So you're either not authenticated with this API, or don't have sufficient privileges, or something of the sort
Nick Eh Likes 15
Nick Eh Likes 15OP•3w ago
But how comes it works on windows 11? Same code Literally just the windows edition And it’s any webpage Doesn’t work
Angius
Angius•3w ago
Like, even if you do a simple
var client = new HttpClient();
var res = await client.GetStringAsync("https://api.isevenapi.xyz/api/iseven/6/");
var client = new HttpClient();
var res = await client.GetStringAsync("https://api.isevenapi.xyz/api/iseven/6/");
it still doesn't work?
leowest
leowest•3w ago
well first thing I would try is, access it from a browser i.e.: just access in a browser at that machine https://api.rec.net/api/players/v2/progression/bulk?id=1
Angius
Angius•3w ago
Or curl it
leowest
leowest•3w ago
and see if it works interesting enough v2 is not even listed in their dev docs

Did you find this page helpful?