Apple Music Api - Create a New Library Playlist returns 504

Hello,


I have been working with the Apple Music Api recently and to much of my dismay the documentation provided by apple on the api is pretty abysmal. Lot of information missing that I needed to fill in the gaps with just some playing around however I wanted to turn here for an error I am receving from creating a new playlist. I have been able to create playlists no problem, each time I am doing so I am also including the tracks relationship with a data array filled with track ID's. So far I have had no issue with the amount of tracks until I crossed 200, specifically 841 tracks in this request and it is failing with an error 504. What I can conclude is that there is for sure a data limit that can be passed with the initial creation of the playlist however this is not documentated so as far as I can tell I am unsure of that number. However, why would they be returning a bad gateway error code in response? Has anyone else run into this issue and if so what have you found? If no one knows in a timely manner then I will hit up apple developer support and try to get an answer for us.


Cheers,


Austin


EDIT


After further reviewing it turns out the playlist is still being created even though I get a 504 error in return, seems to be an issue with the api server. I still implemented a function that creates a playlist for 150 tracks ( saftey) and then adds additional tracks to said playlist every 150 till the total has been reached. I did email apple about this so we shall see what response I get from them!

Replies

First, I think it would be best to get apple support but just some thought to what you are experiencing you can run a Dignostic check on the application a possibly figure out the problem. apple software can run dignostic checks of applications, but you can also send this specific problem or error to feedback assistent which also can help in the events of app errors, bugs. hopefully, this helps a bit.
Hi Austin,

I am having the same problem from time to time. I create the playlist and receive a 504 sometimes (not all the time). I have retry mechanisms for responses that are not 201. When I retry after getting a 504, it usually works after. As you stated, the original response that created the 504 worked and so the retry creates a duplicate playlist.

I will say that I get the 504 response randomly and in my case, it happens even when the amount of tracks are less than 100. My most recent instance happened with only 97 tracks. Let me know if you found a work around this.

Best,