Apple Music API

RSS for tag

Apple Music API integrates streaming music with Apple Music content.

Apple Music API Documentation

Posts under Apple Music API tag

81 Posts
Sort by:
Post not yet marked as solved
0 Replies
277 Views
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
Posted
by Songstats.
Last updated
.
Post not yet marked as solved
2 Replies
460 Views
I know that I can use the iTunes COM Interface for Windows to control the app or get info of the currently playing track etc. Now I was wondering if the new Apple Music Client for Windows also has this functionality? Sadly I couldn't find any documentation online.
Posted
by bjm021.
Last updated
.
Post not yet marked as solved
0 Replies
253 Views
In Version 14.2 Beta (23C5030f), existing playlists do not appear to be recognized. When Move to Playlist is selected, the program returns "Create New Playlist" even though there are existing playlists. This seems to be a new problem with this beta release.
Posted
by kgf3076.
Last updated
.
Post not yet marked as solved
4 Replies
1.5k Views
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
Posted Last updated
.
Post not yet marked as solved
2 Replies
394 Views
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.
Posted
by hntdhs.
Last updated
.
Post not yet marked as solved
0 Replies
503 Views
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>
Posted
by Tajantino.
Last updated
.
Post not yet marked as solved
0 Replies
360 Views
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? 😅
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.6k Views
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!
Posted Last updated
.
Post not yet marked as solved
0 Replies
407 Views
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.
Posted
by hntdhs.
Last updated
.
Post not yet marked as solved
0 Replies
386 Views
Hello! I'd like to understand if I can use snippets from songs, such as just the choruses or other parts, like previews for my commercial application, similar to how it's done on TikTok. Can I use them alongside other content? If it's a paid service, how can I find out the cost of such usage?
Posted
by yesenge.
Last updated
.
Post marked as solved
1 Replies
486 Views
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!
Posted
by janunn.
Last updated
.
Post not yet marked as solved
4 Replies
2.5k Views
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>
Posted Last updated
.
Post not yet marked as solved
0 Replies
385 Views
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.
Posted
by Songstats.
Last updated
.
Post not yet marked as solved
1 Replies
831 Views
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?
Posted Last updated
.
Post not yet marked as solved
2 Replies
880 Views
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.
Posted
by D0nMalte.
Last updated
.
Post not yet marked as solved
1 Replies
862 Views
In my Developer account under Certificates, Identifiers &amp; Profiles --&gt; Keys, I cannot add the "Media Services (MusicKit, ShazamKit) key. I have an app identifier where the "MusicKit" App Service is selected. How can I get the key to be available for this app?
Posted
by austinjm.
Last updated
.
Post not yet marked as solved
2 Replies
1.9k Views
Hello, I'm using systemMusicPlayer to play Apple Music Live Radio Station got from Apple Music API. But it doesn't work. How can I do that? Error: Test[46751:13235249] [SDKPlayback] Failed to prepareToPlay error: Error Domain=MPMusicPlayerControllerErrorDomain Code=6 "Failed to prepare to play" UserInfo={NSDebugDescription=Failed to prepare to play} My implementation:    let musicPlayerController = MPMusicPlayerController.systemMusicPlayer musicPlayerController.beginGeneratingPlaybackNotifications()      musicPlayerController.setQueue(with: "ra.978194965")     musicPlayerController.play() API response: { “id”: “ra.978194965”, “type”: “stations”, “href”: “/v1/catalog/us/stations/ra.978194965”, “attributes”: { “artwork”: { “width”: 4320, “url”: “https://is2-ssl.mzstatic.com/image/thumb/Features114/v4/e5/10/76/e5107683-9e51-ebc5-3901-d8fbd65f2c2a/source/{w}x{h}sr.jpeg”, “height”: 1080, “textColor3”: “332628”, “textColor2”: “120509”, “textColor4”: “33272a”, “textColor1”: “000000”, “bgColor”: “f4f4f4”, “hasP3”: false }, “url”: “https://music.apple.com/us/station/apple-music-1/ra.978194965”, “mediaKind”: “audio”, “supportedDrms”: [ “fairplay”, “playready”, “widevine” ], “requiresSubscription”: false, “name”: “Apple Music 1”, “kind”: “streaming”, “radioUrl”: “itsradio://music.apple.com/us/station/ra.978194965”, “playParams”: { “id”: “ra.978194965”, “kind”: “radioStation”, “format”: “stream”, “stationHash”: “CgkIBRoFlaS40gMQBA”, “mediaType”: 0 }, “editorialNotes”: { “name”: “Apple Music 1”, “short”: “The new music that matters.”, “tagline”: “The new music that matters.” }, “isLive”: true } },``` Thank you! Best regards, MichaelNg
Posted
by MichaelCS.
Last updated
.