mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 04:20:46 +00:00
Activities
(Activities)
Overview
Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.
Activities are associated with HTTP replies via a special X-Plex-Activity header which contains the UUID of the activity.
Activities are optional cancellable. If cancellable, they may be cancelled via the DELETE endpoint. Other details:
- They can contain a
progress(from 0 to 100) marking the percent completion of the activity. - They must contain an
typewhich is used by clients to distinguish the specific activity. - They may contain a
Contextobject with attributes which associate the activity with various specific entities (items, libraries, etc.) - The may contain a
Responseobject which attributes which represent the result of the asynchronous operation.
Available Operations
- GetServerActivities - Get Server Activities
- CancelServerActivities - Cancel Server Activities
GetServerActivities
Get Server Activities
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
var sdk = new PlexAPISDK(security: new Models.Components.Security() {
AccessToken = "<YOUR_API_KEY_HERE>",
});
var res = await sdk.Activities.GetServerActivitiesAsync();
// handle response
Response
CancelServerActivities
Cancel Server Activities
Example Usage
using PlexAPI;
using PlexAPI.Models.Components;
using PlexAPI.Models.Requests;
var sdk = new PlexAPISDK(security: new Models.Components.Security() {
AccessToken = "<YOUR_API_KEY_HERE>",
});
var res = await sdk.Activities.CancelServerActivitiesAsync(activityUUID: "string");
// handle response
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ActivityUUID |
string | ✔️ | The UUID of the activity to cancel. |