Sessions
Get Session History
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
Sessions
Get Session History
This will Retrieve a listing of all history views.
GET
/
status
/
sessions
/
history
/
all
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.Sessions.GetSessionHistoryAsync(
sort: "<value>",
accountId: 1,
filter: new QueryParamFilter() {},
librarySectionID: 12
);
// handle response
{
"MediaContainer": {
"size": 10855,
"Metadata": [
{
"historyKey": "/status/sessions/history/1",
"key": "/library/metadata/32171",
"ratingKey": "32171",
"librarySectionID": "2",
"parentKey": "/library/metadata/32170",
"grandparentKey": "/library/metadata/32132",
"title": "The Noise That Blue Makes",
"grandparentTitle": "Taskmaster",
"type": "episode",
"thumb": "/library/metadata/32171/thumb/-1",
"parentThumb": "/library/metadata/32170/thumb/1654134301",
"grandparentThumb": "/library/metadata/32132/thumb/1703933346",
"grandparentArt": "/library/metadata/32132/art/1703933346",
"index": 1,
"parentIndex": 13,
"originallyAvailableAt": "2022-04-14T00:00:00.000Z",
"viewedAt": 1654139223,
"accountID": 1,
"deviceID": 5
}
]
}
}
Authorizations
Plex Authentication Token
Query Parameters
Sorts the results by the specified field followed by the direction (asc, desc)
Filter results by those that are related to a specific users id
Filters content by field and direction/equality (Unknown if viewedAt is the only supported column)
Example:
{
"viewed-at-greater-than": { "value": "viewedAt>" },
"viewed-at-greater-than-or-equal-to": { "value": "viewedAt>=>" },
"viewed-at-less-than": { "value": "viewedAt<" }
}
Filters the results based on the id of a valid library section
Response
200
application/json
List of Plex Sessions
Example:
10855
Example:
"/status/sessions/history/1"
Example:
"/library/metadata/32171"
Example:
"32171"
Example:
"2"
Example:
"/library/metadata/32170"
Example:
"/library/metadata/32132"
Example:
"The Noise That Blue Makes"
Example:
"Taskmaster"
Example:
"episode"
Example:
"/library/metadata/32171/thumb/-1"
Example:
"/library/metadata/32170/thumb/1654134301"
Example:
"/library/metadata/32132/thumb/1703933346"
Example:
"/library/metadata/32132/art/1703933346"
Example:
1
Example:
13
Example:
"2022-04-14T00:00:00.000Z"
Example:
1654139223
Example:
1
Example:
5
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.Sessions.GetSessionHistoryAsync(
sort: "<value>",
accountId: 1,
filter: new QueryParamFilter() {},
librarySectionID: 12
);
// handle response
{
"MediaContainer": {
"size": 10855,
"Metadata": [
{
"historyKey": "/status/sessions/history/1",
"key": "/library/metadata/32171",
"ratingKey": "32171",
"librarySectionID": "2",
"parentKey": "/library/metadata/32170",
"grandparentKey": "/library/metadata/32132",
"title": "The Noise That Blue Makes",
"grandparentTitle": "Taskmaster",
"type": "episode",
"thumb": "/library/metadata/32171/thumb/-1",
"parentThumb": "/library/metadata/32170/thumb/1654134301",
"grandparentThumb": "/library/metadata/32132/thumb/1703933346",
"grandparentArt": "/library/metadata/32132/art/1703933346",
"index": 1,
"parentIndex": 13,
"originallyAvailableAt": "2022-04-14T00:00:00.000Z",
"viewedAt": 1654139223,
"accountID": 1,
"deviceID": 5
}
]
}
}