How to get an ID for an Apple Music Playlist
Asked Answered
P

2

7

I am currently making a swift app that creates a playlist for a user via MusicKit / the Apple Music API. It creates this playlist in the user's library and returns an ID of the format p.XXXXXXXX. I would like to then open up the iOS Music App and display the newly created playlist to the user by opening up an itunes.apple.com/us/playlist/XXXXXX?app=music link. However, the IDs for this URL all are of the format pl.XXXXXXXX. The Mac iTunes app has a Share Playlist button that can get the pl.XXXXXXX id for the playlist, but how can I get this ID in swift when the Apple Music API only returns the p.XXXXXXXXXX id? Thanks!

Pomade answered 12/4, 2018 at 18:24 Comment(0)
P
4

For anyone who comes across this question in the future:

I reached out to Apple for code-level support. Based on their response, the current SDK and API does not allow for this functionality (as of iOS 11.3) so it is currently impossible to retrieve the iTunes playlist ID from a playlist created via the Apple Music API.

Pomade answered 20/5, 2018 at 17:55 Comment(0)
N
-2

I'm not sure if the Apple Music API has been updated, but now you may use the "Get All Library Playlists" as a web service endpoint to fetch all library playlists, including the ones created by the user.

Check in the link: https://developer.apple.com/documentation/applemusicapi/get_all_library_playlists

The response contains both formats of ids: globalId "pl.xxxxxxxxxxxxxxxx" and id "p.xxxxxxxxxxxxx".

I once had a related issue, you may check in: How to get a Catalog Playlist id for Apple Music API?

Numerary answered 10/6, 2019 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.