(media)
API Calls interacting with Plex Media Server Media
- markPlayed - Mark Media Played
- markUnplayed - Mark Media Unplayed
- updatePlayProgress - Update Media Play Progress
This will mark the provided media key as Played.
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.media.markPlayed(59398);
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
key |
number | ✔️ | The media key to mark as played | [object Object] |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.MarkPlayedResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.MarkPlayedResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
This will mark the provided media key as Unplayed.
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.media.markUnplayed(59398);
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
key |
number | ✔️ | The media key to mark as Unplayed | [object Object] |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.MarkUnplayedResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.MarkUnplayedResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |
This API command can be used to update the play progress of a media item.
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.media.updatePlayProgress("<value>", 90000, "played");
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
key |
string | ✔️ | the media key | |
time |
number | ✔️ | The time, in milliseconds, used to set the media playback progress. | [object Object] |
state |
string | ✔️ | The playback state of the media item. | [object Object] |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
Promise<operations.UpdatePlayProgressResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.UpdatePlayProgressResponseBody | 401 | application/json |
errors.SDKError | 4xx-5xx | / |