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 Top Watched Content
This endpoint will return the top watched content from libraries of a certain type
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Components;
using LukeHagar.PlexAPI.SDK.Models.Requests;
var sdk = new PlexAPI(accessToken: "<YOUR_API_KEY_HERE>");
var res = await sdk.Library.GetTopWatchedContentAsync(
type: GetTopWatchedContentQueryParamType.TvShow,
includeGuids: 1
);
// handle response
{
"MediaContainer": {
"size": 1,
"allowSync": true,
"identifier": "com.plexapp.plugins.library",
"mediaTagPrefix": "/system/bundle/media/flags/",
"mediaTagVersion": 1698860922,
"Metadata": [
{
"ratingKey": "17",
"key": "/library/metadata/17",
"guid": "plex://movie/5d77683f6f4521001ea9dc53",
"slug": "waterloo-road",
"studio": "Universal Pictures",
"type": "movie",
"title": "Serenity",
"librarySectionTitle": "Movies",
"librarySectionID": 1,
"librarySectionKey": "/library/sections/1",
"contentRating": "PG-13",
"summary": "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.",
"index": 1,
"audienceRating": 9.1,
"year": 2005,
"tagline": "They aim to misbehave.",
"thumb": "/library/metadata/17/thumb/1705637165",
"art": "/library/metadata/17/art/1705637165",
"duration": 141417,
"originallyAvailableAt": "2005-09-29T00:00:00.000Z",
"leafCount": 222,
"viewedLeafCount": 100,
"childCount": 13,
"addedAt": 1705637164,
"updatedAt": 1705637165,
"globalViewCount": 80,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"Genre": [
{
"id": 184,
"filter": "genre=184",
"tag": "Thriller"
}
],
"Country": [
{
"id": 116,
"filter": "country=116",
"tag": "United States of America"
}
],
"Guid": [
{
"id": "tvdb://2337"
}
],
"Role": [
{
"id": 220,
"filter": "actor=220",
"tag": "Dennis Keiffer",
"tagKey": "5d77683554f42c001f8c4708",
"role": "Bar Guy (uncredited)",
"thumb": "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg"
}
],
"User": [
{
"id": 220
}
]
}
]
}
}
Authorizations
Plex Authentication Token
Query Parameters
Adds the Guids object to the response
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
Response
1
true
"com.plexapp.plugins.library"
"/system/bundle/media/flags/"
1698860922
"17"
"/library/metadata/17"
"plex://movie/5d77683f6f4521001ea9dc53"
"waterloo-road"
"Universal Pictures"
"movie"
"Serenity"
"Movies"
1
"/library/sections/1"
"PG-13"
"Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job."
1
9.1
2005
"They aim to misbehave."
"/library/metadata/17/thumb/1705637165"
"/library/metadata/17/art/1705637165"
141417
"2005-09-29T00:00:00.000Z"
222
100
13
1705637164
1705637165
80
"rottentomatoes://image.rating.upright"
"tvdb://2337"
220
"actor=220"
"Dennis Keiffer"
"5d77683554f42c001f8c4708"
"Bar Guy (uncredited)"
"https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg"
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Components;
using LukeHagar.PlexAPI.SDK.Models.Requests;
var sdk = new PlexAPI(accessToken: "<YOUR_API_KEY_HERE>");
var res = await sdk.Library.GetTopWatchedContentAsync(
type: GetTopWatchedContentQueryParamType.TvShow,
includeGuids: 1
);
// handle response
{
"MediaContainer": {
"size": 1,
"allowSync": true,
"identifier": "com.plexapp.plugins.library",
"mediaTagPrefix": "/system/bundle/media/flags/",
"mediaTagVersion": 1698860922,
"Metadata": [
{
"ratingKey": "17",
"key": "/library/metadata/17",
"guid": "plex://movie/5d77683f6f4521001ea9dc53",
"slug": "waterloo-road",
"studio": "Universal Pictures",
"type": "movie",
"title": "Serenity",
"librarySectionTitle": "Movies",
"librarySectionID": 1,
"librarySectionKey": "/library/sections/1",
"contentRating": "PG-13",
"summary": "Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.",
"index": 1,
"audienceRating": 9.1,
"year": 2005,
"tagline": "They aim to misbehave.",
"thumb": "/library/metadata/17/thumb/1705637165",
"art": "/library/metadata/17/art/1705637165",
"duration": 141417,
"originallyAvailableAt": "2005-09-29T00:00:00.000Z",
"leafCount": 222,
"viewedLeafCount": 100,
"childCount": 13,
"addedAt": 1705637164,
"updatedAt": 1705637165,
"globalViewCount": 80,
"audienceRatingImage": "rottentomatoes://image.rating.upright",
"Genre": [
{
"id": 184,
"filter": "genre=184",
"tag": "Thriller"
}
],
"Country": [
{
"id": 116,
"filter": "country=116",
"tag": "United States of America"
}
],
"Guid": [
{
"id": "tvdb://2337"
}
],
"Role": [
{
"id": 220,
"filter": "actor=220",
"tag": "Dennis Keiffer",
"tagKey": "5d77683554f42c001f8c4708",
"role": "Bar Guy (uncredited)",
"thumb": "https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg"
}
],
"User": [
{
"id": 220
}
]
}
]
}
}