Server
Media
Butler
Plex
Library
- GETGet Hash Value
- GETGet Recently Added
- GETGet All Libraries
- GETGet library details
- DELDelete library section
- GETGet library items
- GETGet all media of library
- GETRefresh Metadata Of The Library
- GETSearch library
- GETGet Genres of library media
- GETGet Countries of library media
- GETGet Actors of library media
- GETSearch All Libraries
- GETGet Media Metadata
- GETGet Items Children
- GETGet Top Watched Content
- GETGet On Deck
Watchlist
Playlists
Authentication
Sessions
Get Recently Added
This endpoint will return the recently added content.
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Components;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using System.Collections.Generic;
var sdk = new PlexAPI(accessToken: "<YOUR_API_KEY_HERE>");
GetRecentlyAddedLibraryRequest req = new GetRecentlyAddedLibraryRequest() {
ContentDirectoryID = 2,
PinnedContentDirectoryID = new List<long>() {
3,
5,
7,
13,
12,
1,
6,
14,
2,
10,
16,
17,
},
SectionID = 2,
Type = QueryParamType.TvShow,
};
var res = await sdk.Library.GetRecentlyAddedLibraryAsync(req);
// handle response
{
"MediaContainer": {
"Type": [
{
"key": "/library/sections/2/all?type=2",
"type": "filter",
"subtype": "clip",
"title": "TV Shows",
"active": false,
"Filter": [
{
"filter": "genre",
"filterType": "string",
"key": "/library/sections/2/genre?type=2",
"title": "Genre",
"type": "filter",
"advanced": true
}
],
"Sort": [
{
"default": "asc",
"active": false,
"activeDirection": "asc",
"defaultDirection": "asc",
"descKey": "titleSort:desc",
"firstCharacterKey": "/library/sections/2/firstCharacter",
"key": "titleSort",
"title": "Title"
}
],
"Field": [
{
"key": "show.title",
"title": "Show Title",
"type": "string",
"subType": "rating"
}
]
}
],
"FieldType": [
{
"type": "tag",
"Operator": [
{
"key": "=",
"title": "is"
}
]
}
],
"size": 50,
"allowSync": true,
"identifier": "com.plexapp.plugins.library",
"mediaTagPrefix": "/system/bundle/media/flags/",
"mediaTagVersion": 1680021154,
"mixedParents": true,
"Metadata": [
{
"allowSync": true,
"librarySectionID": 1,
"librarySectionTitle": "Movies",
"librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",
"ratingKey": 59398,
"key": "/library/metadata/59398",
"guid": "plex://movie/5e161a83bea6ac004126e148",
"studio": "Marvel Studios",
"type": "movie",
"title": "Ant-Man and the Wasp: Quantumania",
"contentRating": "PG-13",
"summary": "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.",
"rating": 4.7,
"audienceRating": 8.3,
"year": 2023,
"tagline": "Witness the beginning of a new dynasty.",
"thumb": "/library/metadata/59398/thumb/1681888010",
"art": "/library/metadata/59398/art/1681888010",
"duration": 7474422,
"originallyAvailableAt": "2023-02-15T00:00:00.000Z",
"addedAt": 1681803215,
"updatedAt": 1681888010,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"chapterSource": "media",
"primaryExtraKey": "/library/metadata/59399",
"ratingImage": "rottentomatoes://image.rating.rotten",
"Media": [
{
"id": 120345,
"duration": 7474422,
"bitrate": 3623,
"width": 1920,
"height": 804,
"aspectRatio": 2.35,
"audioChannels": 6,
"audioCodec": "ac3",
"videoCodec": "h264",
"videoResolution": 1080,
"container": "mp4",
"videoFrameRate": "24p",
"optimizedForStreaming": 0,
"has64bitOffsets": true,
"videoProfile": "high",
"Part": [
{
"id": 120353,
"key": "/library/parts/120353/1681803203/file.mp4",
"duration": 7474422,
"file": "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4",
"size": 3395307162,
"container": "mp4",
"has64bitOffsets": true,
"hasThumbnail": 1,
"optimizedForStreaming": true,
"videoProfile": "high"
}
]
}
],
"Genre": [
{
"tag": "Comedy"
}
],
"Director": [
{
"tag": "Peyton Reed"
}
],
"Writer": [
{
"tag": "Jeff Loveness"
}
],
"Country": [
{
"tag": "United States of America"
}
],
"Role": [
{
"tag": "Paul Rudd"
}
]
}
]
}
}
Authorizations
Plex Authentication Token
Query Parameters
2
[3, 5, 7, 13, 12, 1, 6, 14, 2, 10, 16, 17]
The library section ID for filtering content.
2
The type of media to retrieve or filter by. 1 = movie 2 = show 3 = season 4 = episode E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
1
, 2
, 3
, 4
, 8
, 9
, 10
2
Adds the Meta object to the response
0
, 1
1
The index of the first item to return. If not specified, the first item will be returned. If the number of items exceeds the limit, the response will be paginated. By default this is 0
0
The number of items to return. If not specified, all items will be returned. If the number of items exceeds the limit, the response will be paginated. By default this is 50
50
Response
The Meta object is only included in the response if the includeMeta
parameter is set to 1
.
"/library/sections/2/all?type=2"
"filter"
"TV Shows"
false
"clip"
"genre"
"string"
"/library/sections/2/genre?type=2"
"Genre"
"filter"
true
The direction of the sort. Can be either asc
or desc
.
asc
, desc
"asc"
"titleSort"
"Title"
"asc"
false
The direction of the sort. Can be either asc
or desc
.
asc
, desc
"asc"
"titleSort:desc"
"/library/sections/2/firstCharacter"
50
"com.plexapp.plugins.library"
"/system/bundle/media/flags/"
1680021154
1
"Movies"
"322a231a-b7f7-49f5-920f-14c61199cd30"
59398
"/library/metadata/59398"
"plex://movie/5e161a83bea6ac004126e148"
"Marvel Studios"
"movie"
"Ant-Man and the Wasp: Quantumania"
"PG-13"
"Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible."
4.7
8.3
2023
"Witness the beginning of a new dynasty."
"/library/metadata/59398/thumb/1681888010"
"/library/metadata/59398/art/1681888010"
7474422
"2023-02-15T00:00:00.000Z"
1681803215
1681888010
"rottentomatoes://image.rating.upright"
"media"
"/library/metadata/59399"
"rottentomatoes://image.rating.rotten"
120345
7474422
3623
1920
804
2.35
6
"ac3"
"h264"
1080
"mp4"
"24p"
0
"high"
120353
"/library/parts/120353/1681803203/file.mp4"
7474422
"/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4"
3395307162
"mp4"
1
"high"
"Peyton Reed"
"Jeff Loveness"
"United States of America"
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Components;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using System.Collections.Generic;
var sdk = new PlexAPI(accessToken: "<YOUR_API_KEY_HERE>");
GetRecentlyAddedLibraryRequest req = new GetRecentlyAddedLibraryRequest() {
ContentDirectoryID = 2,
PinnedContentDirectoryID = new List<long>() {
3,
5,
7,
13,
12,
1,
6,
14,
2,
10,
16,
17,
},
SectionID = 2,
Type = QueryParamType.TvShow,
};
var res = await sdk.Library.GetRecentlyAddedLibraryAsync(req);
// handle response
{
"MediaContainer": {
"Type": [
{
"key": "/library/sections/2/all?type=2",
"type": "filter",
"subtype": "clip",
"title": "TV Shows",
"active": false,
"Filter": [
{
"filter": "genre",
"filterType": "string",
"key": "/library/sections/2/genre?type=2",
"title": "Genre",
"type": "filter",
"advanced": true
}
],
"Sort": [
{
"default": "asc",
"active": false,
"activeDirection": "asc",
"defaultDirection": "asc",
"descKey": "titleSort:desc",
"firstCharacterKey": "/library/sections/2/firstCharacter",
"key": "titleSort",
"title": "Title"
}
],
"Field": [
{
"key": "show.title",
"title": "Show Title",
"type": "string",
"subType": "rating"
}
]
}
],
"FieldType": [
{
"type": "tag",
"Operator": [
{
"key": "=",
"title": "is"
}
]
}
],
"size": 50,
"allowSync": true,
"identifier": "com.plexapp.plugins.library",
"mediaTagPrefix": "/system/bundle/media/flags/",
"mediaTagVersion": 1680021154,
"mixedParents": true,
"Metadata": [
{
"allowSync": true,
"librarySectionID": 1,
"librarySectionTitle": "Movies",
"librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30",
"ratingKey": 59398,
"key": "/library/metadata/59398",
"guid": "plex://movie/5e161a83bea6ac004126e148",
"studio": "Marvel Studios",
"type": "movie",
"title": "Ant-Man and the Wasp: Quantumania",
"contentRating": "PG-13",
"summary": "Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.",
"rating": 4.7,
"audienceRating": 8.3,
"year": 2023,
"tagline": "Witness the beginning of a new dynasty.",
"thumb": "/library/metadata/59398/thumb/1681888010",
"art": "/library/metadata/59398/art/1681888010",
"duration": 7474422,
"originallyAvailableAt": "2023-02-15T00:00:00.000Z",
"addedAt": 1681803215,
"updatedAt": 1681888010,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"chapterSource": "media",
"primaryExtraKey": "/library/metadata/59399",
"ratingImage": "rottentomatoes://image.rating.rotten",
"Media": [
{
"id": 120345,
"duration": 7474422,
"bitrate": 3623,
"width": 1920,
"height": 804,
"aspectRatio": 2.35,
"audioChannels": 6,
"audioCodec": "ac3",
"videoCodec": "h264",
"videoResolution": 1080,
"container": "mp4",
"videoFrameRate": "24p",
"optimizedForStreaming": 0,
"has64bitOffsets": true,
"videoProfile": "high",
"Part": [
{
"id": 120353,
"key": "/library/parts/120353/1681803203/file.mp4",
"duration": 7474422,
"file": "/movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4",
"size": 3395307162,
"container": "mp4",
"has64bitOffsets": true,
"hasThumbnail": 1,
"optimizedForStreaming": true,
"videoProfile": "high"
}
]
}
],
"Genre": [
{
"tag": "Comedy"
}
],
"Director": [
{
"tag": "Peyton Reed"
}
],
"Writer": [
{
"tag": "Jeff Loveness"
}
],
"Country": [
{
"tag": "United States of America"
}
],
"Role": [
{
"tag": "Paul Rudd"
}
]
}
]
}
}