1

I can get the user rating for a song from the API as follows. As the API returns the success response, I understand my developer token and user token are in correct form and valid.

$ 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}}]}  

However when I try to delete the rating or set it API returns HTTP 501.

To delete the user rating I'm sending HTTP DELETE as described in API documentation:

$ 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&#58;&#47;&#47;api&#46;music&#46;apple&#46;com&#47;v1&#47;me&#47;ratings&#47;songs&#47;1249510807 not supported.<P>  
Reference&#32;&#35;8&#46;296cd417&#46;1498987100&#46;11cbeb73  
</BODY></HTML> 

To set the rating to a different value, I use HTTP PUT with JSON payload as described in 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&#58;&#47;&#47;api&#46;music&#46;apple&#46;com&#47;v1&#47;me&#47;ratings&#47;songs&#47;1249510807 not supported.<P>  
Reference&#32;&#35;8&#46;296cd417&#46;1498987015&#46;11caa18d  
</BODY></HTML>  

HTML response dumps the URL as HTTP, but I v that verify that my initial request is HTTPS.

Is there anyone executing these requests without problems?

Thanks in advance.

UPDATE: As of Jul 12th 2017, the API is returning documented responses. I guess it was a bug at the API side and it is fixed now.

Bahri Okuroglu
  • 178
  • 1
  • 7
  • Why are you passing input data in the body? From the docs it just looks as if you need to call the url without any extra data. Have you tried it? – Losiowaty Jul 03 '17 at 05:33
  • Thank you @Losiowaty. I was sending input data in the body only for "adding rating" case. My interpretation of the Apple's example was sending JSON in the payload. I am not sending any data for delete case and I still get the same response. How do you think I should for the request? – Bahri Okuroglu Jul 03 '17 at 14:44
  • Looks like your DELETE is sent to an HTTP endpoint - did you try HTTPS? – Ted Hosmann Jul 06 '17 at 20:28
  • You are right Ted, the HTML response mentions HTTP for the URL. Unfortunately I made sure already, that I'm using HTTPS. Can you successfully execute DELETE / PUT? `$ url="https://api.music.apple.com/v1/me/ratings/songs/1249510807" $ 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: 297 Expires: Thu, 06 Jul 2017 20:33:17 GMT Date: Thu, 06 Jul 2017 20:33:17 GMT Connection: close` – Bahri Okuroglu Jul 06 '17 at 20:37

0 Answers0