我是WP编程的初学者。我的第一个应用程序是关于SoundCloud的,我正在尝试使用HttpRequestMessage
获取一个轨道列表,但响应消息是"未找到"。
我不知道为什么当我在网站浏览器中输入这个URI时,我得到了我需要的字符串。
我的代码是:
private async Task<string> GetMyTracks(string id)
{
HttpClient client = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Put, string.Format(
"https://api.soundcloud.com/users/{0}/tracks.json", id));
string tokenqrq = string.Format(
"client_id={0}",app.ClientID);
request.Content = new StringContent(tokenqrq, Encoding.UTF8, "application/x-www-form-urlencoded");
HttpResponseMessage response = await client.SendAsync(request);
string responseString = await response.Content.ReadAsStringAsync();
return responseString;
}