(Media)
API Calls interacting with Plex Media Server Media
This will mark the provided media key as Played.
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using LukeHagar.PlexAPI.SDK.Models.Components;
var sdk = new PlexAPI(
accessToken: "<YOUR_API_KEY_HERE>",
clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58",
clientName: "Plex for Roku",
clientVersion: "2.4.1",
platform: "Roku",
deviceNickname: "Roku 3"
);
var res = await sdk.Media.MarkPlayedAsync(key: 59398D);
// handle response
Parameter |
Type |
Required |
Description |
Example |
Key |
double |
✔️ |
The media key to mark as played |
59398 |
MarkPlayedResponse
Error Type |
Status Code |
Content Type |
LukeHagar.PlexAPI.SDK.Models.Errors.MarkPlayedBadRequest |
400 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.MarkPlayedUnauthorized |
401 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.SDKException |
4XX, 5XX |
*/* |
This will mark the provided media key as Unplayed.
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using LukeHagar.PlexAPI.SDK.Models.Components;
var sdk = new PlexAPI(
accessToken: "<YOUR_API_KEY_HERE>",
clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58",
clientName: "Plex for Roku",
clientVersion: "2.4.1",
platform: "Roku",
deviceNickname: "Roku 3"
);
var res = await sdk.Media.MarkUnplayedAsync(key: 59398D);
// handle response
Parameter |
Type |
Required |
Description |
Example |
Key |
double |
✔️ |
The media key to mark as Unplayed |
59398 |
MarkUnplayedResponse
Error Type |
Status Code |
Content Type |
LukeHagar.PlexAPI.SDK.Models.Errors.MarkUnplayedBadRequest |
400 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.MarkUnplayedUnauthorized |
401 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.SDKException |
4XX, 5XX |
*/* |
This API command can be used to update the play progress of a media item.
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using LukeHagar.PlexAPI.SDK.Models.Components;
var sdk = new PlexAPI(
accessToken: "<YOUR_API_KEY_HERE>",
clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58",
clientName: "Plex for Roku",
clientVersion: "2.4.1",
platform: "Roku",
deviceNickname: "Roku 3"
);
var res = await sdk.Media.UpdatePlayProgressAsync(
key: "<key>",
time: 90000D,
state: "played"
);
// handle response
Parameter |
Type |
Required |
Description |
Example |
Key |
string |
✔️ |
the media key |
|
Time |
double |
✔️ |
The time, in milliseconds, used to set the media playback progress. |
90000 |
State |
string |
✔️ |
The playback state of the media item. |
played |
UpdatePlayProgressResponse
Error Type |
Status Code |
Content Type |
LukeHagar.PlexAPI.SDK.Models.Errors.UpdatePlayProgressBadRequest |
400 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.UpdatePlayProgressUnauthorized |
401 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Gets the banner image of the media item
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using LukeHagar.PlexAPI.SDK.Models.Components;
var sdk = new PlexAPI(
accessToken: "<YOUR_API_KEY_HERE>",
clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58",
clientName: "Plex for Roku",
clientVersion: "2.4.1",
platform: "Roku",
deviceNickname: "Roku 3"
);
GetBannerImageRequest req = new GetBannerImageRequest() {
RatingKey = 9518,
Width = 396,
Height = 396,
MinSize = 1,
Upscale = 1,
XPlexToken = "CV5xoxjTpFKUzBTShsaf",
};
var res = await sdk.Media.GetBannerImageAsync(req);
// handle response
Parameter |
Type |
Required |
Description |
request |
GetBannerImageRequest |
✔️ |
The request object to use for the request. |
GetBannerImageResponse
Error Type |
Status Code |
Content Type |
LukeHagar.PlexAPI.SDK.Models.Errors.GetBannerImageBadRequest |
400 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.GetBannerImageUnauthorized |
401 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.SDKException |
4XX, 5XX |
*/* |
Gets the thumbnail image of the media item
using LukeHagar.PlexAPI.SDK;
using LukeHagar.PlexAPI.SDK.Models.Requests;
using LukeHagar.PlexAPI.SDK.Models.Components;
var sdk = new PlexAPI(
accessToken: "<YOUR_API_KEY_HERE>",
clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58",
clientName: "Plex for Roku",
clientVersion: "2.4.1",
platform: "Roku",
deviceNickname: "Roku 3"
);
GetThumbImageRequest req = new GetThumbImageRequest() {
RatingKey = 9518,
Width = 396,
Height = 396,
MinSize = 1,
Upscale = 1,
XPlexToken = "CV5xoxjTpFKUzBTShsaf",
};
var res = await sdk.Media.GetThumbImageAsync(req);
// handle response
Parameter |
Type |
Required |
Description |
request |
GetThumbImageRequest |
✔️ |
The request object to use for the request. |
GetThumbImageResponse
Error Type |
Status Code |
Content Type |
LukeHagar.PlexAPI.SDK.Models.Errors.GetThumbImageBadRequest |
400 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.GetThumbImageUnauthorized |
401 |
application/json |
LukeHagar.PlexAPI.SDK.Models.Errors.SDKException |
4XX, 5XX |
*/* |