【发布时间】:2023-01-01 23:31:50
【问题描述】:
我只需要以下响应正文中的“点数”:300。
这是正文:
{
"channel": "abcd",
"username": "fgh",
"points": 300,
"pointsAlltime": 0,
"watchtime": 0,
"rank": 1
}
代码:
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.streamelements.com/kappa/v2/points/abcd/fgh"),
Headers =
{
{ "Accept", "application/json" },
{ "Authorization", "Bearer 123" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
我只需要点值。 - 300
【问题讨论】:
标签: c# http request httprequest httpresponse