在 VB.net 中制作 SoundCloud 桌面客户端时遇到了麻烦:我根本无法喜欢和不喜欢曲目。
登录、播放音乐、获得点赞……一切正常,但点赞曲目给我一个 404(找不到文件)错误。
这是我正在使用的代码:
Dim request As WebRequest = WebRequest.Create("https://api.soundcloud.com/me/favorites" & "?client_id=" & Soundcloud.client_ID & "&oauth_token=" & _Token)
request.Method = "PUT"
Dim postData As String = Track.id
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
Console.WriteLine(CType(response, HttpWebResponse).StatusDescription)
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Console.WriteLine(responseFromServer)
reader.Close()
dataStream.Close()
response.Close()
开发者网站并没有真正说明什么,它只是说:“GET,PUT,DELETE /users/{id}/favorites/{id} 用户最喜欢的曲目”
有谁能帮忙吗?提前致谢。