Apple Music API

RSS for tag

Apple Music API integrates streaming music with Apple Music content.

Posts under Apple Music API tag

80 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Request for Free Access to the Apple Music API and Apple Link Shortener for Affiliate Links
Dear Apple devs, I hope this message finds you well. I am writing to seek your guidance and assistance in a matter related to my blog, which features affiliate links to the Apple Music store. Currently, I manage all aspects of my blog independently. However, I find myself facing the formidable task of updating 300 articles, and I am exploring options to streamline and automate this process. To achieve this automation, I am looking into the creation of affiliate links through the Apple Music API and the affiliate program. While this approach promises efficiency and enhanced user experience, I must acknowledge a financial constraint. Acquiring a developer account, a prerequisite for API access, involves a cost of €99, which presents a challenge within my budgetary constraints. I have come across information suggesting the possibility of requesting a fee waiver, yet the process entails an initial payment with no guarantees. This leads me to seek your advice on the most viable and cost-effective solution to address this predicament. Your insights and recommendations would be greatly appreciated, as they will guide my decision on the best course of action moving forward. I am committed to upholding the integrity of my blog and ensuring its continued success, and your expertise will be instrumental in achieving this goal. Thank you in advance for your time and assistance. I eagerly await your response and look forward to resolving this matter with your support.
0
0
471
Nov ’23
iOS 17.1 Features (Credits, Favorite Artist & Playlist Covers)
Hey there, There was so many awesome new changes introduced in iOS 17.1, and we would love to leverage them via the API! Namely: A new endpoint that returns the credits of a song. A way to add an artist to the library of a user. A way to update the cover of a playlist. All these three features are amazing - please let us know if you plan to add them to the API! All the best, Oskar
0
0
283
Nov ’23
MusicKit Dev Token Refresh
I am trying to follow along with this in order to auto generate my dev token on requests to MusicKit, but I am getting an error about by identifier, which was configured Link: https://developer.apple.com/documentation/musickit/using-automatic-token-generation-for-apple-music-api Error: 2022-04-26 14:12:06.353589-0400 [6885:431407] [DataRequesting] Failed retrieving developer token: Error Domain=ICErrorDomain Code=-8200 "Media API Token Service responded with status code: Not Found (404). This suggests that "<set_bundle_ID>" was likely not registered as a valid client identifier." UserInfo={NSDebugDescription=Media API Token Service responded with status code: Not Found (404). This suggests that "<set_bundle_ID>" was likely not registered as a valid client identifier., NSUnderlyingError=0x2827669a0 {Error Domain=AMSErrorDomain Code=301 "Invalid Status Code" UserInfo={NSLocalizedDescription=Invalid Status Code, AMSURL=https://sf-api-token-service.itunes.apple.com/apiToken?REDACTED, AMSStatusCode=404, AMSServerPayload={     message = "Client not found";     status = 40402; }, NSLocalizedFailureReason=The response has an invalid status code}}}. Throwing .developerTokenRequestFailed. error getting token
4
0
1.6k
Oct ’23
Beginner trying to authorize Apple Music API request
I'm a new programmer and I'm trying to work with the Apple Music API as a way to teach myself. So this is probably a dumb question, but I'm using the docs to figure out how to make a request, and I think I have the token all set with the key ID and UNIX time and all that. But I get a 401 Unauthorized back when I send a GET request with it, and I'm having trouble understanding what the docs say about authorization. It says to pass Authorization: Bearer in the header. I'm trying to do that in Insomnia but it must be over my head. I'm guessing there's something obvious that I'm doing wrong, but I'm not sure what. Hoping someone here will take one look at it and be able to tell me. I tried it a few different ways but this is the gist.
2
0
399
Oct ’23
Share Extension - App no longer showing after Xcode/IOS Update
I recently updated to Xcode 15 and IOS 17 and now my Share Extension is no longer appearing. The share extension is meant to take the URL from a song when a user selects share in Apple Music. It was working perfectly before the update, so I'm wondering if I missed something that would cause this error or if this is happening or has happened to anyone else. If so, what's the best way to fix it? Here's my Activation Rule for reference: <dict> <key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>NSExtensionActivationRule</key> <dict> <key>NSExtensionActivationSupportsWebURLWithMaxCount</key> <integer>1</integer> </dict> </dict> <key>NSExtensionMainStoryboard</key> <string>MainInterface</string> <key>NSExtensionPointIdentifier</key> <string>com.apple.share-services</string> </dict> </dict>
0
0
519
Oct ’23
Music app on my iPad not working as intended
Hi! I have a 4th gen iPad Air with 17.1 beta 1 version loaded on it. When trying to edit a playlist, every time I remove a song, it always goes back to the top of my playlist, causing me to have to scroll back down. But that’s not the only problem; once I do get back to where I was in my list, and before I can do anything else it will just go back to the top of my list without me doing anything! it doesn’t happen every time but enough times to make it hard for me to continue what I’m trying to do. I have closed the app several times, and even restarted my iPad a few times but still the issues persist! Help? 😅
0
0
365
Oct ’23
Apple Music Kit Web API - User's Top Played Songs/Artists
Hello everyone! I am using the web version of the Apple Music Kit API, and similar to how Apple is able to produce a user's year in rewind playlist showing the most played artists/songs from a year, I am trying to replicate it for either a year or all time. I have been searching the internet for days trying to figure it out, but I've been completely stuck. I am able to make the following HTTP request successfully. GET https://api.music.apple.com/v1/me/library/songs/ which returns back the user's library of songs, but I haven't figured out how to get the play count. I have tried adding a query like such ?extend=playCount, but that doesn't work. I can see here that the Swift Music Kit API is able to extend a play count property, but I haven't been able to figure it out for Web. Ideally, I am looking for an endpoint that just shows a user's top artist/tracks similar to Spotify, however, whenever I try to use the heavy in rotation endpoint here, it always returns an empty array. The way that I have described is the long-roundabout way where I'll have to fetch each individual song and sort by playCount. But if anyone happens to know how I can do either of the options I've described, it will be truly appreciated ! I've seen other forums posts from years ago, but hopefully there's been a discovered way. Thank you!
2
1
1.7k
Sep ’23
Response data for playlists and songs in Apple Music API
I was thinking about paying to join the Apple Developer program for access to the Apple Music API, and making an app just for practice in improving my skills. I was looking at the sample response data in the documentation online, and noticed there's some stuff missing that I would want to use. Mainly what songs are in a playlist (it looks like you get that info for a catalog playlist but not a library playlist, which seems backwards but maybe I'm confused about what those mean), and information about particular songs in a user's library like number of plays, date last played, etc. Basically I thought you'd get access to anything you can see in the Apple Music Player on the desktop version. It seems like that's obviously not true but I was surprised, so I thought I'd ask to see if anyone who has used the API can tell me for sure. Probably don't want to pay if you don't get access to all the data I was thinking about.
0
0
421
Sep ’23
MusicDataRequest responding with an Internal Service Error when creating a playlist folder
I am trying to create a new playlist folder in Apple Music using MusicKit on iOS 16. However, I am receiving an Internal Service Error when sending the request. This is the code: let urlString = "https://api.music.apple.com/v1/me/library/playlist-folders" let url = URL(string: urlString)! let body = LibraryPlaylistFolderCreationRequest( attributes: .init( name: "test-playlist-folder"), relationships: .init( parent: .init( data: [.init(id: "playlistsroot", type: "library-playlist-folders")]))) var urlRequest = URLRequest(url: url) urlRequest.httpMethod = "POST" urlRequest.httpBody = try JSONEncoder().encode(body) let request = MusicDataRequest(urlRequest: urlRequest) let response = try await request.response() let responseString = String(data: response.data, encoding: .utf8) print(responseString) When I print the request body using the following code snippet, I get the output as seen below: let jsonBody = try JSONEncoder().encode(body) print(String(data: jsonBody, encoding: .utf8)) Output of the above snippet: Optional("{\"attributes\":{\"name\":\"test-playlist-folder\"},\"relationships\":{\"parent\":{\"data\":[{\"id\":\"playlistsroot\",\"type\":\"library-playlist-folders\"}]}}}") Which should conform to the JSON scheme provided in the docs: https://developer.apple.com/documentation/applemusicapi/libraryplaylistfoldercreationrequest And this is the error output: [DataRequesting] Failed to perform MusicDataRequest.Context( url: "https://api.music.apple.com/v1/me/library/playlist-folders", currentRetryCounts: [.other: 1] ) with MusicDataRequest.Error( status: 500, code: 50000, title: "Internal Service Error", detailText: "", id: "VK23VIZ6AAM5IVP4GIFQ6VXPLU", originalResponse: MusicDataResponse( data: 111 bytes, urlResponse: <NSHTTPURLResponse: 0x000000028042b0c0> ) ). After a lot of trial and error, I don't think I know what the underlying issue is. Is MusicDataRequest not designed to issue POST requests? Is it something else? Kind regards!
1
0
496
Sep ’23
ERROR_FAILED_TO_VERIFY_JWT error when trying to link with Apple Music
I want to use Apple Music using MusicKit. I've created MusicKit identifier and private key by following all the steps mentioned here: https://help.apple.com/developer-account/#/devce5522674 I have my Team ID, the Music key ID and the private key (.p8 file) with me. I tried to generate the required JWT token by using many scripts that were mentioned in similar questions asked here, but none of them have worked so far. When I try to authenticate, I'm getting an error ERROR_FAILED_TO_VERIFY_JWT. Ref: Codes I've tried to generate the JWT token from: Thread 130168 - https://developer.apple.com/forums/thread/130168 A nice and simple blog by Lee Martin [Blog - Creating an Apple Music API Token] Thread 79074 - https://developer.apple.com/forums/thread/79074 Many other links But sadly, none of them worked and I had to post this question. I have tried the sample Android app: https://developer.apple.com/download/more/?=Android%20MusicKit After authentication, the page goes on with an infinite loader, which I believe must be because of the same error ERROR_FAILED_TO_VERIFY_JWT Also tried with this HTML page: <html> <head> <meta name="apple-music-developer-token" content="the-JWT-token-generated-using-the-reference-links"> <meta name="apple-music-app-name" content="My App Name"> <meta name="apple-music-app-build" content="1978.4.1"> </head> <body> <button id="apple-music-authorize"></button> <button id="apple-music-unauthorize"></button> </body> <script src="link-to-musickit.js"></script> <script> let music = MusicKit.getInstance(); &#9;&#9;music.player.play(); &#9;&#9;music.authorize().then(function() { &#9;&#9;&#9;&#9;music.player.play(); &#9;&#9;}); &#9;&#9;music.authorize().then(function() { &#9;&#9;&#9;&#9; music.api.library.albums.then(function(cloudAlbums) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;// user's cloudAlbums &#9;&#9;&#9;&#9;}); &#9;&#9;}); </script> </html>
4
0
2.5k
Sep ’23
Apple Music API - Add Tracks to beginning of Library Playlist
We are using the following endpoint to add songs to a user's library playlist: https://developer.apple.com/documentation/applemusicapi/add_tracks_to_a_library_playlist However, it looks like it is currently only possible to add tracks to the end of a playlist, and there is no way of re-ordering the tracks either. It would be great if we were able to pass an index of the position where the object should be added within the playlist, or if that's too complicated, then at least have a param that allows to add tracks to the beginning of the playlist. Adding new tracks at the end of a playlists that already has a lot of songs just isn't effective as they won't be discovered.
0
0
390
Aug ’23
Music API does not return smart playlists from Library
I tried to use smart playlist to get all liked songs. But Smart playlists are not returned from Library Playlists endpoint https://api.music.apple.com/v1/me/library/playlists — only the regular playlists are returned.Is there a way to fetch user's smart playlists?If not is there a way to fetch liked songs? Currently I have to load ALL songs and the ratings for all of them, then manually filter. It takes ridiculous amount of time, especially because page size is limited to 100. Btw, is there a way to increase it?
1
1
846
Aug ’23
Can't access chart playlists for a specific genre
I am trying to offer my users a wide variety of playlists, like Apple Music does in the "explore" section. I fetched the charting playlists for the current storefront, but that's as far as I get. For example, I fetch the top charts genres first. If a user selects a genre I want to display the playlists for this genre, so I call the charts endpoint with the genre as the id but I can't get a response. path = "/v1/catalog/\(storefrontID)/charts" components.queryItems = [ URLQueryItem(name: "types", value: "playlists"), URLQueryItem(name: "chart", value: "most-played") ] if let id = id { let genreQuery = URLQueryItem(name: "genre", value: id) components.queryItems?.append(genreQuery) } Even weirder, I get exactly one genre "Musik" (which isn't a genre) with identifier "34" and storefrontId "de" where it works and I get my playlists. All other genre return empty responses. I try to use AppleMusic API with MusicKit as an addition, but there doesn't seem to be a solution for this problem either.
2
1
889
Aug ’23