Jellyfin Forum
Howto access playlist data through API? - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Howto access playlist data through API? (/t-howto-access-playlist-data-through-api)



Howto access playlist data through API? - Stubbie - 2025-03-21

Hi, I am trying to synchronize playlists in Jellyfin with Music Assistant (a Home Assistant add-on).
"Native" Jellyfin playlist sync fine, but playlists from m3u files either sync empty, or don't sync at all, seemingly depending on how the paths inside are formed.

Anyway, I was curious to see what Jellyfin transmits over the API, but cannot seem to get the GET /Playlists/{playlistId} to work. Using Bruno (an API explorer) I get an 404/"Error processing request." error.

These are my steps:
- GET http://172.16.XXX.XXX:8096/Users to get the user Id
- GET http://172.16.XXX.XXX:8096/Users/<userId>/Items?IncludeItemTypes=ManualPlaylistsFolder to get the Id of the Playlist library
- GET http://172.16.XXX.XXX:8096/Users/<userId>/Items?ParentId=<playlistFolderId> to get a list of playlists. The returned json:

Code:
{
  "Items": [
    {
      "Name": "JF-NATIVE-TEST",
      "ServerId": "db2bc2f8a74649089ee7bf18b3af2023",
      "Id": "1710350a4974e666176baabd410b3339",
      "ChannelId": null,
      "RunTimeTicks": 29178514270,
      "IsFolder": true,
      "Type": "Playlist",
      "UserData": {
        "PlaybackPositionTicks": 0,
        "PlayCount": 0,
        "IsFavorite": false,
        "Played": false,
        "Key": "1710350a-4974-e666-176b-aabd410b3339",
        "ItemId": "00000000000000000000000000000000"
      },
      "ChildCount": 11,
      "ImageTags": {
        "Primary": "fafc487dd1790326e4d67dbde32db8c1"
      },
      "BackdropImageTags": [],
      "ImageBlurHashes": {
        "Primary": {
          "fafc487dd1790326e4d67dbde32db8c1": "eaNu-ZoffQt7J7?Hj[fQfks:fQfQfQfQfQ~Wj[fQkC%2Ioj[fQofoL"
        }
      },
      "LocationType": "FileSystem",
      "MediaType": "Audio"
    },

Finally, I attempt to have a peek inside the playlist, but this GET call fails:
http://172.16.XXX.XXX:8096/Playlists/adf522a24c1d3d5768977d8dd33d5217/Items

Probably something stupid... any ideas?

I am on Jellyfin 10.10.6.
No error messages in the log.


RE: Howto access playlist data through API? - xaque - 2025-03-21

The api docs have this to say, https://api.jellyfin.org/#tag/Playlists/operation/GetPlaylistItems


You try this endpoint?

http://localhost/Playlists/{playlistId}/Items


RE: Howto access playlist data through API? - Stubbie - 2025-03-22

Yeah, I did add the "/Items", my last attempt was without it, and that is what I accidentally copy-pasted above (now corrected).


RE: Howto access playlist data through API? - Stubbie - 2025-03-22

Oh, I just accidentally stumbled on a workaround/solution... It's odd, but this returns me the contents of the playlist. Odd because the intended call to Playlist/../Items doesn't return anything.

Returns contents of playlist:
http://172.16.XXX.XXX:8096/Users/fd6e1bc0fa10483e937549669f3f6fdd/Items?ParentId=<PlaylistId>

This does not:
http://172.16.XXX.XXX:8096/Playlists/<PlaylistId/Items