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

98 Posts
Sort by:
Post not yet marked as solved
0 Replies
183 Views
At random points the recent-played endpoint will be missing songs that a users listened to. I will attach the most recent json but my issues is I listened to 5 jazz songs this afternoon. This morning I listened to 5 songs by the artist Trevor Hall. Yesterday I listened to Astronaut in the Ocean. When I was querying the endpoint this morning. The Trevor Halls songs were included in the return. If I query the endpoint now, they are missing. In the 'Trevor_hall_missing.json' it goes directly from the jazz music, to astronaut in the ocean. Earlier today (I will try and find the json and attach). it would be jazz, Trevor hall, then astronaut. There was no music listened to in between this range. trevor_hall_missing.json trevor_hall_included.json
Posted
by
Post not yet marked as solved
0 Replies
151 Views
In the recently played endpoint, if a user listens to the same song more than once and it only shows up once. For example if they listen to a 10 songs ago, and they listen to it again now. It will only show the most recent play
Posted
by
Post not yet marked as solved
0 Replies
160 Views
Hi, I'm developing a B2B web-app which will be only used internally by other businesses that already are subscribed to the Apple Developer Program. This app has to communicate with the MusicKit API. I'd like to know if I can ask those business to create a Media ID from their developer account and insert their Team ID, Key ID and Secret in my app, in order to be able to generate a token. I'd like to do so in order to avoid any possible request rate limit on my account in case I made the app use my Media ID for all their requests. Is it possible or doing so I may violate any Apple license aggreement? I can't find this answer anywhere
Posted
by
Post not yet marked as solved
0 Replies
157 Views
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.
Posted
by
Post not yet marked as solved
1 Replies
153 Views
As per this documentation shared link below, https://developer.apple.com/documentation/applemusicapi/create_a_new_library_playlist I'm able to get developer token and music user token but I am getting error for 'Invalid Request Body' (400 Bad Request). My body parameters are as follows: { "name": "Demo Playlist", "description" : "This is Demo Playlist" } Please suggest with proper example for body parameters. Thanks!
Posted
by
Post not yet marked as solved
3 Replies
217 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
by
Post not yet marked as solved
1 Replies
203 Views
I'm using MusicKit JS v1, and I've noticed that I can't seem to get playlists with more than 100 songs to shuffle and play past the first 100. The limitation is that the API call made with MusicKit JS default fetch (I'm using the tracks relationship in a playlist) is capped at 100, and I get a 400 error code whenever I try to raise the limit. On the other hand, I can't figure out how to just get the next 100, because I can't seem to get the offset parameter to work correctly in MusicKit JS either. Any recommendations? For reference, something like the below just doesn't work (it only retrieves the first 100 songs or throws an error). await appleMusicState.musicKit.api.playlist(selectedPlaylist.id, {limit: 200}) .then(playlist => { console.log(playlist); }) nor does directly trying to setQueue with the playlist ID await appleMusicState.musicKit.setQueue({playlist: selectedPlaylist.id});
Posted
by
Post not yet marked as solved
0 Replies
151 Views
Hi all Can anybody let me know how I can get chart data from iTunes? I enrolled in developer programs for that but just noticed that it only provides Apple Music API. Is there any way that I can check iTunes chart data? It seems there is iTunes API but it is only for 'search'.
Posted
by
Post not yet marked as solved
1 Replies
182 Views
Last year I built a jukebox app in Mac Catalyst that gives me greater control over my playlists. Specifically it allows scheduling of playlists at certain hours, maintains artist separation, and excludes songs from frequent playback by filtering out recently played items. With the exception of playback time not working and resorting to a weird fix, as reported here, I was very pleased with the result until I upgraded from Big Sur to Monterey this month. I then discovered that the MPMusicPlayerControllerNowPlayingItemDidChange notification has lost functionality, as it only works once per playback queue, then fails to fire until a new playback queue is called up. I had to build a workaround that changes out song info upon playback time reverting to zero, which seems an unnecessary addition to overhead. No one has posted about this yet, so I thought I’d put in my two cents on the matter. Thanks for any attention you can direct toward this… “bug”?
Posted
by
Post marked as solved
1 Replies
296 Views
Hi there! I am trying to map the Apple Music API endpoints to MusicKit. For example, I am looking at the catalog playlist endpoints. To get a catalog playlist by its identifier, it is: let request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: "pl.f4d106fed2bd41149aaacabb233eb5eb") let response = try await request.response() print(response.items) For multiple identifiers, it is:   let request = MusicCatalogResourceRequest<Playlist>(matching: \.id, memberOf: ["pl.f4d106fed2bd41149aaacabb233eb5eb", "pl.4b364b8b182f4115acbf6deb83bd5222"]) let response = try await request.response() print(response.items) To get its relationship like more by curator and featured artists, I can set the properties: var request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: "pl.f4d106fed2bd41149aaacabb233eb5eb") request.properties = [.featuredArtists, .moreByCurator, .tracks] let response = try await request.response() print(response.items) My question is, how can I map the endpoint Get a Catalog Playlist's Relationship Directly by Name" to MusicKit: https://api.music.apple.com/v1/catalog/{storefront}/playlists/{id}/{relationship} The possible value of the relationship can be curator, library, or tracks. Where can I set these relationship values in the MusicKit request? Thank you!
Posted
by
Post not yet marked as solved
1 Replies
283 Views
Hi there! I know that this is not related to MusicKit but Apple Music API, but I am curious to know where to find the activities to use this identifier? Get a Catalog Activity endpoint: https://api.music.apple.com/v1/catalog/{storefront}/activities/{id} If I use the example ID given on the page, I get "Resource Not Found" error. So, where do I get the activities ID?
Posted
by
Post not yet marked as solved
1 Replies
272 Views
Hi, I'm developing an app with ShazamKit and I'd like to check its license agreement in order to know what I can and what I can't do, but I can't find it anywhere. Is there any link where I can find it?
Posted
by
Post not yet marked as solved
0 Replies
148 Views
https://developer.apple.com/documentation/applemusicapi/add_tracks_to_a_library_playlist I use this api with python, post data: https://api.music.apple.com/v1/me/library/playlists/{id}/tracks {'tracks': {'data': [{'id': '310730206', 'type': 'songs'}, {'id': '310730208', 'type': 'songs'}]}} error: 'Unable to parse request body'
Posted
by
Post not yet marked as solved
1 Replies
309 Views
Hi, We have an app which is a music social network, it worked fine on both Spotify/Apple Music up until the last few days, now the Apple Music search function is not working at all. Just wondering have we missed something has changed or any idea why it would be returning null. See image. We've tried other apps that use Apple Music and they seem fine, but nothing has changed on our app. So we know the API is working. We're puzzled. Does anyone have any idea, would be massively appreciated.
Posted
by
Post not yet marked as solved
0 Replies
154 Views
I am able to retrieve a playlist via the API by its ID but how do I retrieve it by the playlist’s name/title? I’m hoping to avoid getting all playlists in a library and searching from there.
Posted
by
Post not yet marked as solved
0 Replies
238 Views
Hi there! I wanted to know, if anyone can answer me .. if I had to implement a WebView as an app (then insert the website) + some native function, how many possibilities are there for it to be accepted by apple and published on the App Store?
Posted
by
Post not yet marked as solved
1 Replies
263 Views
Hello. The Apple Music API has a dedicated endpoint for the user's personal station. I am wondering if the other "For You" stations, such as the "Favorites Mix" and the "New Music Mix" are available? Even if not through a dedicated endpoint, but through searching for them? Thanks. Edit: also the "[Artist] & Similar Artists Station" stations, for that matter.
Posted
by
Post not yet marked as solved
1 Replies
538 Views
Hello, I just submitted FB9939377 about this issue, but figured I'd still post on the forums as well. I have been working on bringing song and album rating functionality to my app, using MusicDataRequest from MusicKit for Swift. When I like or dislike a song, or delete the existing rating, those changes are reflected immediately in the Music app across all of my devices. However, when I try to rate or delete an existing rating for an album, the API request is successful, but the changes are not reflected in Music.app on any of my devices. Querying the /v1/me/ratings/albums/[id] endpoint correctly shows the change that was made, but it does not seem to sync the change to any devices, which continue to show whatever the rating state was before the change I made in my app. I ran 3 tests on albums with the following IDs: 1485040020 - Disliked -> Loved Disliked in Music.app /v1/me/ratings/albums/1485040020 shows the value of the rating attribute as “-1” Changed to “Loved” in my app /v1/me/ratings/albums/1485040020 confirms the value of the rating attribute has changed from “-1” to “1” Music.app on the iPod I used to make the change in my app, as well as another iPhone 11 signed into that Apple ID show the original “Disliked” rating for the album. 1485042017 - Loved -> No Rating Liked in Music.app /v1/me/ratings/albums/1485042017 shows the value of the rating attribute as “1” Deleted the rating from my app /v1/me/ratings/albums/1485042017 now 404s, indicating there is no rating for this album. Music.app on the iPod I used to make the change in my app, as well as another iPhone 11 signed into that Apple ID show the original “Loved” rating for the album. 1485037658 - No Rating -> Loved Confirmed /v1/me/ratings/albums/1485037658 returns a 404, as there is no rating for this album “Loved” the album in my app /v1/me/ratings/albums/1485037658 now returns a value of “1” Music.app on the iPod I used to make the change in my app, as well as another iPhone 11 signed into that Apple ID show me the option to either “Love” or “Suggest Less Like This,” indicating there is no existing rating for the album. There are sysdiagnoses attached to the feedback. Please let me know here or in the Feedback if there is any more information I can provide. Thanks! (P.S., I'm requiring iOS 15 for the next version of my app, so I've finally been digging into MusicKit. What a well-designed and useful API! It's been so quick and easy to replace most of my existing URLSession data task code with MusicKit, and MusicDataRequest is such a thoughtful inclusion to be able to interface with the elements of the API not natively in MusicKit, with the added benefit of not needing to deal with tokens anymore. Thanks to the team for all of their continued hard work on it.)
Posted
by
Post not yet marked as solved
2 Replies
611 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