Explore the catalog with the Apple Music API

RSS for tag

Discuss the WWDC21 session Explore the catalog with the Apple Music API.

Posts under wwdc21-10291 tag

8 Posts

Post

Replies

Boosts

Views

Activity

Getting user library data after Xcode authorization
So I am trying to access my Heavy Rotation content using this command from the Apple Music API website: wget https://api.music.apple.com/v1/me/history/heavy-rotation I made sure to change "me" to my username on Apple Music and I ran this command from my Terminal. It is connecting to the Apple Music API but it is saying that the request is unauthorized. I was surprised by this because I have already granted access on my device after requestAuthorization ran once (after authorization it does not ask again). So why is it saying that the request is unauthorized? Do I need to use my developer token somewhere? Thanks. (base) MacBook-Pro-210:soundtrack nalinkrishnan$ wget https://api.music.apple.com/v1/theonlynalin/history/heavy-rotation --2022-05-02 12:04:18--  https://api.music.apple.com/v1/theonlynalin/history/heavy-rotation Resolving api.music.apple.com (api.music.apple.com)... 2001:559:19:608b::2a1, 2001:559:19:6099::2a1, 2001:559:19:6080::2a1, ... Connecting to api.music.apple.com (api.music.apple.com)|2001:559:19:608b::2a1|:443... connected. HTTP request sent, awaiting response... 401 Unauthorized Username/Password Authentication Failed.
0
0
1.2k
May ’22
How to make a playlist public/create a public playlist?
Hey everyone, I am creating playlist via the MusicKit API and by default it creates the playlist in the users library and the isPublic attribute is set to false. Is there a way to make the playlist public at the time of creation? (Only way to change isPublic = true at this time seems to be through the Music app right now)
1
0
2.5k
Apr ’22
How to get recommendations based on multiple tracks?
Hello, I am trying to get recommendations based on the identifier of multiple tracks. But I am unable to get any results Here is the code I have used to try to get recommendations based on one album let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: URL(string: "https://api.music.apple.com/v1/me/recommendations/1571344275")!)) let dataResponse = try await dataRequest.response() For this I am getting the response: Failed to perform MusicDataRequest.Context(   url: https://api.music.apple.com/v1/me/recommendations/1571344275,   currentRetryCounts: [.other: 1] ) with MusicDataRequest.Error(   status: 404,   code: 40400,   title: "Resource Not Found",   detailText: "Resource with requested id was not found", I have tried used the identifier of songs/albums, to no success. What am I doing wrong?
1
0
2k
Dec ’21
How to fetch next batch of albums for an Artist?
Hello, I am fetching and displaying the .fullalbums for an Artist through the MusicKit api. The JSON response returned has a hasNextBatch: true value, but I am unsure how to fetch and display the next batch. Is this something that can be intelligently retrieved though some MusicKit functionality or does one have to perform another data request to fetch the next batch?
2
0
1.3k
Aug ’21
How to play Music Videos with MusicKit for Swift?
Hello, I am wondering how one can play music videos (with the actual video playing) with the ApplicationMusicPlayer using MusicKit for Swift? There is not much documentation on this, so any help would be appreciated.
Replies
6
Boosts
0
Views
3.1k
Activity
Jan ’26
How to get resources for a Genre?
I am trying to display albums, playlists and artist for a Genre. Does anyone know how to do this or if this is not currently supported by the MusicKit and Apple Music API?
Replies
4
Boosts
0
Views
2.1k
Activity
Jun ’22
Getting user library data after Xcode authorization
So I am trying to access my Heavy Rotation content using this command from the Apple Music API website: wget https://api.music.apple.com/v1/me/history/heavy-rotation I made sure to change "me" to my username on Apple Music and I ran this command from my Terminal. It is connecting to the Apple Music API but it is saying that the request is unauthorized. I was surprised by this because I have already granted access on my device after requestAuthorization ran once (after authorization it does not ask again). So why is it saying that the request is unauthorized? Do I need to use my developer token somewhere? Thanks. (base) MacBook-Pro-210:soundtrack nalinkrishnan$ wget https://api.music.apple.com/v1/theonlynalin/history/heavy-rotation --2022-05-02 12:04:18--  https://api.music.apple.com/v1/theonlynalin/history/heavy-rotation Resolving api.music.apple.com (api.music.apple.com)... 2001:559:19:608b::2a1, 2001:559:19:6099::2a1, 2001:559:19:6080::2a1, ... Connecting to api.music.apple.com (api.music.apple.com)|2001:559:19:608b::2a1|:443... connected. HTTP request sent, awaiting response... 401 Unauthorized Username/Password Authentication Failed.
Replies
0
Boosts
0
Views
1.2k
Activity
May ’22
How to make a playlist public/create a public playlist?
Hey everyone, I am creating playlist via the MusicKit API and by default it creates the playlist in the users library and the isPublic attribute is set to false. Is there a way to make the playlist public at the time of creation? (Only way to change isPublic = true at this time seems to be through the Music app right now)
Replies
1
Boosts
0
Views
2.5k
Activity
Apr ’22
How to get recommendations based on multiple tracks?
Hello, I am trying to get recommendations based on the identifier of multiple tracks. But I am unable to get any results Here is the code I have used to try to get recommendations based on one album let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: URL(string: "https://api.music.apple.com/v1/me/recommendations/1571344275")!)) let dataResponse = try await dataRequest.response() For this I am getting the response: Failed to perform MusicDataRequest.Context(   url: https://api.music.apple.com/v1/me/recommendations/1571344275,   currentRetryCounts: [.other: 1] ) with MusicDataRequest.Error(   status: 404,   code: 40400,   title: "Resource Not Found",   detailText: "Resource with requested id was not found", I have tried used the identifier of songs/albums, to no success. What am I doing wrong?
Replies
1
Boosts
0
Views
2k
Activity
Dec ’21
How to fetch content like the Browse tab in Apple Music
Hello, Is there any way to get content like what is displayed in the Browse tab of Apple Music using MusicKit or Apple Music API? I checked the contents of the default recommendations in the Apple Music API, and these were my personal recommendations. Is it possible to get common recommendations?
Replies
1
Boosts
0
Views
1.1k
Activity
Sep ’21
How to fetch next batch of albums for an Artist?
Hello, I am fetching and displaying the .fullalbums for an Artist through the MusicKit api. The JSON response returned has a hasNextBatch: true value, but I am unsure how to fetch and display the next batch. Is this something that can be intelligently retrieved though some MusicKit functionality or does one have to perform another data request to fetch the next batch?
Replies
2
Boosts
0
Views
1.3k
Activity
Aug ’21
Can you get an Album from a Song with MusicKit?
Is it possible to get an album from a song in MusicKit? I haven't been able to find a way to do so currently. I have tried using .with() but it appears that album is not supported. What I am looking for is properties on the Song like what is present on MPMediaItem such as albumTitle, genre, etc.
Replies
3
Boosts
0
Views
1.3k
Activity
Jul ’21