mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 04:20:46 +00:00
Media
(Media)
Overview
API Calls interacting with Plex Media Server Media
Available Operations
- MarkPlayed - Mark Media Played
- MarkUnplayed - Mark Media Unplayed
- UpdatePlayProgress - Update Media Play Progress
MarkPlayed
This will mark the provided media key as Played.
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
using PlexAPI.Models.Requests;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman");
var res = await sdk.Media.MarkPlayedAsync(key: 59398D);
// handle response
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
Key |
double | ✔️ | The media key to mark as played | 59398 |
Response
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| PlexAPI.Models.Errors.MarkPlayedResponseBody | 401 | application/json |
| PlexAPI.Models.Errors.SDKException | 4xx-5xx | / |
MarkUnplayed
This will mark the provided media key as Unplayed.
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
using PlexAPI.Models.Requests;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman");
var res = await sdk.Media.MarkUnplayedAsync(key: 59398D);
// handle response
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
Key |
double | ✔️ | The media key to mark as Unplayed | 59398 |
Response
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| PlexAPI.Models.Errors.MarkUnplayedResponseBody | 401 | application/json |
| PlexAPI.Models.Errors.SDKException | 4xx-5xx | / |
UpdatePlayProgress
This API command can be used to update the play progress of a media item.
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
using PlexAPI.Models.Requests;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman");
var res = await sdk.Media.UpdatePlayProgressAsync(
key: "<value>",
time: 90000D,
state: "played");
// handle response
Parameters
| 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 |
Response
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| PlexAPI.Models.Errors.UpdatePlayProgressResponseBody | 401 | application/json |
| PlexAPI.Models.Errors.SDKException | 4xx-5xx | / |