Get All Activities
A Plex server can have multiple activities running at different times. Activities such as scanning media, database maintenance or streaming can happen either on-demand or on a schedule.
You can view these activities in from the Plex Web app, or use this API command to request them from the server.
URL
GET http://{ip_address}:32400/activites/?X-Plex-Token={plex_token}
Parameters
Name | Description |
---|---|
ip_address | The IP address of the Plex Media server. |
plex_token | The Plex token. |
Return Status
HTTP Code | Description |
---|---|
200 | Success - The request was successful. |
401 | Unauthorized - The Plex token provided was not valid. |
Response
XML string value that lists all the current activites running on the server. An example of the XML returned from the request is shown below:
<?xml version="1.0" encoding="UTF-8"?> <MediaContainer size="1"> <Activity uuid="c3f190e4-eabb-4b3d-8811-b7c1f183560e" type="library.update.section" cancellable="0" userID="1" title="Scanning Photos" subtitle="4th Birthday" progress="30"> <Context librarySectionID="1" /> </Activity> </MediaContainer>
The XML returned provides a list of the all the running activities on the Plex server. The root is the MediaContainer
element. This element contains a single attribute that indicates the number of activites that are running.
Attribute | Description |
---|---|
size | The number of activities. |
The MediaContainer
element will still be returned if no activites are running. The size
attribute will be 0, and there will be no Activity
child elements.
Within the MediaContainer
there are one or more Activity
child elements. Each Activity
element represents one running activity on the Plex server.
Attribute | Description |
---|---|
uuid | Unique identifier for the activity. |
type | The type of activity that is running. |
cancellable | Flag indicating the activity can be cancelled. 0 - the activity can't be cancelled, 1 - the activity can be cancelled. |
userID | The ID of the user running the activity. |
title | The description of the activity. |
subtitle | Additional description or the activity. |
progress | The percentage of the activity that has completed. |
An activity can include one or more Context
child elements. These elements include additional information that is related to the activity, such as the library ID for a scan.
Attribute | Description |
---|---|
librarySectionID | The identifier for the library section. |
Examples
curl -X GET http://{ip_address}:32400/activites/?X-Plex-Token={plex_token}
import requests plex_url = http://{ip_address}:32400/activites/?X-Plex-Token={plex_token} response = requests.get(plex_url) print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/activites/?X-Plex-Token={plex_token}' -Method 'GET' Write-Output $response