我可以通过API获取歌曲的用户评分,如下所示。当API返回成功响应时,我理解我的开发人员令牌和用户令牌的格式正确且有效。
$ echo $url
https://api.music.apple.com/v1/me/ratings/songs/1249510807
$ curl -H "Authorization: Bearer $token" -H "Music-User-Token: $userToken" $url
{"data":[{"id":"1249510807","type":"ratings","href":"/v1/me/ratings/songs/1249510807","attributes":{"value":1}}]}
但是,当我尝试删除评级或设置时,API返回HTTP 501。
要删除用户评级,我按照API documentation中的说明发送HTTP DELETE:
$ curl -D - -X "DELETE" -H "Authorization: Bearer $token" -H "Music-User-Token: $userToken" $url
HTTP/1.1 501 Not Implemented
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 298
Expires: Sun, 02 Jul 2017 09:18:20 GMT
Date: Sun, 02 Jul 2017 09:18:20 GMT
Connection: close
<HTML><HEAD>
<TITLE>Unsupported Request</TITLE>
</HEAD><BODY>
<H1>Unsupported Request</H1>
DELETE to http://api.music.apple.com/v1/me/ratings/songs/1249510807 not supported.<P>
Reference #8.296cd417.1498987100.11cbeb73
</BODY></HTML>
要将评级设置为其他值,我使用带有JSON有效负载的HTTP PUT,如documentation中所述:
$ curl -D - -X "PUT" --data "{\"type\":\"rating\",\"attributes\":{\"value\":-1}}" -H "Content-type: application/json" -H "Authorization: Bearer $token" -H "Music-User-Token: $userToken" $url
HTTP/1.1 501 Not Implemented
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 295
Expires: Sun, 02 Jul 2017 09:16:55 GMT
Date: Sun, 02 Jul 2017 09:16:55 GMT
Connection: close
<HTML><HEAD>
<TITLE>Unsupported Request</TITLE>
</HEAD><BODY>
<H1>Unsupported Request</H1>
PUT to http://api.music.apple.com/v1/me/ratings/songs/1249510807 not supported.<P>
Reference #8.296cd417.1498987015.11caa18d
</BODY></HTML>
HTML响应将URL转储为HTTP,但我确认我的初始请求是HTTPS。
是否有人在没有问题的情况下执行这些请求?
提前致谢。
更新:截至2017年7月12日,API正在返回文档化的回复。我想这是API方面的一个错误,现在已修复。