Jellyfin 接口文档
参考文档:
认证
AuthenticateByName 登录
POST: [host]/Users/AuthenticateByName
body(application/json
):
参数名 | 是否必填 | 默认值 | 备注 |
---|---|---|---|
Username | Y | 用户名 | |
Pw | Y | 密码 |
response:
{
"User": {
"Name": "username",
"ServerId": "68ca97fexxxf41a08axxxf3d057a5f75",
"Id": "cb70exxx1bxxx96ab14xxx6151ba2250",
"HasPassword": true,
"HasConfiguredPassword": true,
"HasConfiguredEasyPassword": false,
"EnableAutoLogin": false,
"LastLoginDate": "2024-04-19T02:51:02.6245939Z",
"LastActivityDate": "2024-04-19T02:51:02.6245939Z",
"Configuration": {
"PlayDefaultAudioTrack": true,
"SubtitleLanguagePreference": "",
"DisplayMissingEpisodes": false,
"GroupedFolders": [],
"SubtitleMode": "Default",
"DisplayCollectionsView": false,
"EnableLocalPassword": false,
"OrderedViews": [],
"LatestItemsExcludes": [],
"MyMediaExcludes": [],
"HidePlayedInLatest": true,
"RememberAudioSelections": true,
"RememberSubtitleSelections": true,
"EnableNextEpisodeAutoPlay": true
},
"Policy": {
"IsAdministrator": true,
"IsHidden": true,
"IsDisabled": false,
"BlockedTags": [],
"EnableUserPreferenceAccess": true,
"AccessSchedules": [],
"BlockUnratedItems": [],
"EnableRemoteControlOfOtherUsers": true,
"EnableSharedDeviceControl": true,
"EnableRemoteAccess": true,
"EnableLiveTvManagement": true,
"EnableLiveTvAccess": true,
"EnableMediaPlayback": true,
"EnableAudioPlaybackTranscoding": true,
"EnableVideoPlaybackTranscoding": true,
"EnablePlaybackRemuxing": true,
"ForceRemoteSourceTranscoding": false,
"EnableContentDeletion": true,
"EnableContentDeletionFromFolders": [],
"EnableContentDownloading": true,
"EnableSyncTranscoding": true,
"EnableMediaConversion": true,
"EnabledDevices": [],
"EnableAllDevices": true,
"EnabledChannels": [],
"EnableAllChannels": true,
"EnabledFolders": [],
"EnableAllFolders": true,
"InvalidLoginAttemptCount": 0,
"LoginAttemptsBeforeLockout": -1,
"MaxActiveSessions": 0,
"EnablePublicSharing": true,
"BlockedMediaFolders": [],
"BlockedChannels": [],
"RemoteClientBitrateLimit": 0,
"AuthenticationProviderId": "Jellyfin.Server.Implementations.Users.DefaultAuthenticationProvider",
"PasswordResetProviderId": "Jellyfin.Server.Implementations.Users.DefaultPasswordResetProvider",
"SyncPlayAccess": "CreateAndJoinGroups"
}
},
"SessionInfo": {
"PlayState": {
"CanSeek": false,
"IsPaused": false,
"IsMuted": false,
"RepeatMode": "RepeatNone"
},
"AdditionalUsers": [],
"Capabilities": {
"PlayableMediaTypes": [],
"SupportedCommands": [],
"SupportsMediaControl": false,
"SupportsContentUploading": false,
"SupportsPersistentIdentifier": true,
"SupportsSync": false
},
"RemoteEndPoint": "172.27.0.1",
"PlayableMediaTypes": [],
"Id": "15fffxxxd3fxxx30cca43f59fbe23e5b",
"UserId": "cb70eae21b42496ab14xxx6151xxx250",
"UserName": "username",
"Client": "StreamMusicTest",
"LastActivityDate": "2024-04-19T02:51:02.8736846Z",
"LastPlaybackCheckIn": "0001-01-01T00:00:00.0000000Z",
"DeviceName": "MBP",
"DeviceId": "6tgrf7a0qwcfrxxx3bxka0vb",
"ApplicationVersion": "1.2.6",
"IsActive": true,
"SupportsMediaControl": false,
"SupportsRemoteControl": false,
"NowPlayingQueue": [],
"NowPlayingQueueFullItems": [],
"HasCustomDeviceName": false,
"ServerId": "68ca97fe91ff41xxxaa2xxxd057a5f75",
"SupportedCommands": []
},
"AccessToken": "602f3582cxxx4d2xxx83d920ad606e22",
"ServerId": "68ca97fe91fxxxx08aaxxx3d057a5f75"
}
在后续的请求中,需要携带以下参数:
参数名 | 备注 |
---|---|
MediaBrowser Client | 客户端名称 |
Device | 设备名 |
DeviceId | 设备Id |
Version | 客户端版本号 |
Token | 访问令牌,登录后从响应中的 AccessToken 字段获取 |
最后,将以上参数组装起来放在请求头中:
Authorization: MediaBrowser Client="$clientName", Device="$deviceName", DeviceId="$deviceId", Version="$clientVersion"
提示
响应中的 User.Id
在后续很多请求中都有用到,建议登录后保存一下。
Ping 测试服务器连通性
GET: [host]/System/Ping
请求节点
Items 获取专辑列表
GET: [host]/Users/[UserId]/Items
query:
参数名 | 备注 |
---|---|
GenreIds | 类型ID,可选 |
SortBy | 排序方式列表,可选值: Random , DateCreated , PremiereDate , PlayCount , DatePlayed , SortName , CommunityRating |
SortOrder | 排序,可选值: Ascending , Descending |
IncludeItemTypes | 包含的项目类型,可选值:MusicAlbum |
Recursive | 是否递归查询 |
Fields | 包含的字段列表,可选值:SortName , BasicSyncInfo , ChildCount , DateCreated |
ImageTypeLimit | 返回的每个图片类型图片数量 |
EnableImageTypes | 图片类型列表,可选值:Primary , Backdrop , Banner , Thumb |
StartIndex | 起始行数 |
Limit | 最大数量,可选 |
artistIds | 歌手 id 列表,可选 |
SearchTerm | 搜索词,可选 |
response:
{
"Items": [
{
"Name": "飞驰于你",
"ServerId": "68ca97fe91ff41a08aa2ff3d057a5f75",
"Id": "bb725906dce0e1d5dcbb5e2aab50f590",
"DateCreated": "2024-03-25T09:34:11.7249608Z",
"SortName": "飞驰于你",
"PremiereDate": "2018-01-01T00:00:00.0000000Z",
"ChannelId": null,
"RunTimeTicks": 2441376768,
"ProductionYear": 2018,
"IsFolder": true,
"Type": "MusicAlbum",
"ParentBackdropItemId": "9cb24036603a4bbdaf15891d3f8215b0",
"ParentBackdropImageTags": [
"17c8f1f8c484ca3f6f9dee5102176e1e"
],
"UserData": {
"PlaybackPositionTicks": 0,
"PlayCount": 0,
"IsFavorite": false,
"Played": false,
"Key": "bb725906-dce0-e1d5-dcbb-5e2aab50f590"
},
"ChildCount": 1,
"Artists": [
"许嵩"
],
"ArtistItems": [
{
"Name": "许嵩",
"Id": "9cb24036603a4bbdaf15891d3f8215b0"
}
],
"AlbumArtist": "许嵩",
"AlbumArtists": [
{
"Name": "许嵩",
"Id": "9cb24036603a4bbdaf15891d3f8215b0"
}
],
"ImageTags": {
"Primary": "b9a921b8a933b371c1075b3c9d046352"
},
"BackdropImageTags": [],
"ImageBlurHashes": {
"Primary": {
"b9a921b8a933b371c1075b3c9d046352": "eH9QXCRj0K%M?HD%oe-;RkIUE2of$*NFNHt7ayR*ofs.%2ayIoofxa"
},
"Backdrop": {
"17c8f1f8c484ca3f6f9dee5102176e1e": "WTHetT_3.9?bjFt8%hRPofWBRit70L9FMwRjozM{-;IUjZayWXt7"
}
},
"LocationType": "FileSystem"
}
],
"TotalRecordCount": 42,
"StartIndex": 0
}
Items/[id] 获取专辑信息
GET: [host]/Users/[UserId]/Items/[id]
response:
{
"Name": "飞驰于你",
"ServerId": "68ca97fe91ff41a08aa2ff3d057a5f75",
"Id": "bb725906dce0e1d5dcbb5e2aab50f590",
"Etag": "2d38f05eeaa5ac3b0afb97617bc7f30d",
"DateCreated": "2024-03-25T09:34:11.7249608Z",
"CanDelete": true,
"CanDownload": false,
"SortName": "飞驰于你",
"PremiereDate": "2018-01-01T00:00:00.0000000Z",
"ExternalUrls": [],
"Path": "/media/许嵩/飞驰于你",
"EnableMediaSourceDisplay": true,
"ChannelId": null,
"Taglines": [],
"Genres": [],
"CumulativeRunTimeTicks": 2441376768,
"RunTimeTicks": 2441376768,
"PlayAccess": "Full",
"ProductionYear": 2018,
"RemoteTrailers": [],
"ProviderIds": {},
"IsFolder": true,
"ParentId": "e630c2b62934f5dbab323976e997f90c",
"Type": "MusicAlbum",
"People": [],
"Studios": [],
"GenreItems": [],
"ParentBackdropItemId": "9cb24036603a4bbdaf15891d3f8215b0",
"ParentBackdropImageTags": [
"17c8f1f8c484ca3f6f9dee5102176e1e"
],
"LocalTrailerCount": 0,
"UserData": {
"PlaybackPositionTicks": 0,
"PlayCount": 0,
"IsFavorite": false,
"Played": false,
"Key": "bb725906-dce0-e1d5-dcbb-5e2aab50f590"
},
"RecursiveItemCount": 1,
"ChildCount": 1,
"SpecialFeatureCount": 0,
"DisplayPreferencesId": "f13d7f51d4f1f8b6fcd620855eb88c1e",
"Tags": [],
"PrimaryImageAspectRatio": 1,
"Artists": [
"许嵩"
],
"ArtistItems": [
{
"Name": "许嵩",
"Id": "9cb24036603a4bbdaf15891d3f8215b0"
}
],
"AlbumArtist": "许嵩",
"AlbumArtists": [
{
"Name": "许嵩",
"Id": "9cb24036603a4bbdaf15891d3f8215b0"
}
],
"ImageTags": {
"Primary": "b9a921b8a933b371c1075b3c9d046352"
},
"BackdropImageTags": [],
"ImageBlurHashes": {
"Primary": {
"b9a921b8a933b371c1075b3c9d046352": "eH9QXCRj0K%M?HD%oe-;RkIUE2of$*NFNHt7ayR*ofs.%2ayIoofxa"
},
"Backdrop": {
"17c8f1f8c484ca3f6f9dee5102176e1e": "WTHetT_3.9?bjFt8%hRPofWBRit70L9FMwRjozM{-;IUjZayWXt7"
}
},
"LocationType": "FileSystem",
"LockedFields": [],
"LockData": false
}
AlbumArtists 获取专辑艺术家列表
GET: [host]/Artists/AlbumArtists
其他格式与歌手列表一致。
Artists 获取歌手列表
GET: [host]/Artists
query:
参数名 | 备注 |
---|---|
SortBy | 排序方式列表,可选值: Random , DateCreated , PremiereDate , PlayCount , DatePlayed , SortName , CommunityRating |
SortOrder | 排序,可选值: Ascending , Descending |
Recursive | 是否递归查询 |
Fields | 包含的字段列表,可选值:SortName , BasicSyncInfo , PrimaryImageAspectRatio |
ImageTypeLimit | 返回的每个图片类型图片数量 |
EnableImageTypes | 图片类型列表,可选值:Primary , Backdrop , Banner , Thumb |
StartIndex | 起始行数 |
Limit | 最大数量,可选 |
userId | 用户ID |
SearchTerm | 搜索词,可选 |
response:
{
"Items": [
{
"Name": "许嵩",
"ServerId": "68ca97fe91ff41a08aa2ff3d057a5f75",
"Id": "9cb24036603a4bbdaf15891d3f8215b0",
"SortName": "许嵩",
"ChannelId": null,
"RunTimeTicks": 47480836096,
"Type": "MusicArtist",
"UserData": {
"PlaybackPositionTicks": 0,
"PlayCount": 0,
"IsFavorite": true,
"Played": false,
"Key": "Artist-Musicbrainz-ca084e75-0f3e-4c05-9f4d-b2714a8c8bb5"
},
"PrimaryImageAspectRatio": 1,
"ImageTags": {
"Primary": "cd6cc0deefafccfc624ae98786cbcf89"
},
"BackdropImageTags": [
"17c8f1f8c484ca3f6f9dee5102176e1e"
],
"ImageBlurHashes": {
"Backdrop": {
"17c8f1f8c484ca3f6f9dee5102176e1e": "WTHetT_3.9?bjFt8%hRPofWBRit70L9FMwRjozM{-;IUjZayWXt7"
},
"Primary": {
"cd6cc0deefafccfc624ae98786cbcf89": "eIFE.a-:^6IAxZ56E1.7-;t7snV@RkbHX8~CtRV[RPE1NGaekCxtt7"
}
},
"LocationType": "FileSystem"
}
],
"TotalRecordCount": 1,
"StartIndex": 0
}
Items/[id] 获取歌手信息
GET: [host]/Users/[UserId]/Items/[id]
response:
{
"Name": "许嵩",
"ServerId": "68ca97fe91ff41a08aa2ff3d057a5f75",
"Id": "9cb24036603a4bbdaf15891d3f8215b0",
"Etag": "5c8277637eb996c93c816e3b637b92f2",
"DateCreated": "2024-03-31T00:53:11.0325164Z",
"CanDelete": false,
"CanDownload": false,
"SortName": "许嵩",
"ExternalUrls": [
{
"Name": "MusicBrainz",
"Url": "https://musicbrainz.org/artist/ca084e75-0f3e-4c05-9f4d-b2714a8c8bb5"
}
],
"Path": "/config/metadata/artists/许嵩",
"EnableMediaSourceDisplay": true,
"ChannelId": null,
"Taglines": [],
"Genres": [],
"RunTimeTicks": 47480834304,
"PlayAccess": "Full",
"RemoteTrailers": [],
"ProviderIds": {
"MusicBrainzArtist": "ca084e75-0f3e-4c05-9f4d-b2714a8c8bb5"
},
"ParentId": null,
"Type": "MusicArtist",
"People": [],
"Studios": [],
"GenreItems": [],
"LocalTrailerCount": 0,
"UserData": {
"PlaybackPositionTicks": 0,
"PlayCount": 0,
"IsFavorite": true,
"Played": false,
"Key": "Artist-Musicbrainz-ca084e75-0f3e-4c05-9f4d-b2714a8c8bb5"
},
"ChildCount": 174,
"SpecialFeatureCount": 0,
"DisplayPreferencesId": "184fdd0115d1192d2c763ca9df5e4ccc",
"Tags": [],
"PrimaryImageAspectRatio": 1,
"ImageTags": {
"Primary": "cd6cc0deefafccfc624ae98786cbcf89"
},
"BackdropImageTags": [
"17c8f1f8c484ca3f6f9dee5102176e1e"
],
"ImageBlurHashes": {
"Backdrop": {
"17c8f1f8c484ca3f6f9dee5102176e1e": "WTHetT_3.9?bjFt8%hRPofWBRit70L9FMwRjozM{-;IUjZayWXt7"
},
"Primary": {
"cd6cc0deefafccfc624ae98786cbcf89": "eIFE.a-:^6IAxZ56E1.7-;t7snV@RkbHX8~CtRV[RPE1NGaekCxtt7"
}
},
"LocationType": "FileSystem",
"LockedFields": [],
"SongCount": 132,
"AlbumCount": 42,
"MusicVideoCount": 0,
"LockData": false
}
Similar 获取相似歌手
GET: [host]/Artists/[id]/Similar
query:
参数名 | 备注 |
---|---|
limit | 结果数量 |
Fields | 包含的字段列表,可选值:SortName , BasicSyncInfo , PrimaryImageAspectRatio , Overview |
response:
{
"Items": [],
"TotalRecordCount": 0,
"StartIndex": 0
}
Images 图片链接
GET: [host]/Items/[id]/Primary?fillHeight=600&fillWidth=600
备注
请求头需要添加授权信息。
Playlists 创建歌单
POST: [host]/Playlists
body(application/json
):
参数名 | 备注 |
---|---|
Name | 歌单名 |
Ids | 包含的歌曲ID列表 |
UserId | 用户名 |
MediaType | 媒体类型,可选值:Audio |
response:
{
"Id": "bea612652ad4b3578c76fa87a13e7fa7"
}