PlexPHP
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$response = $sdk->activities->getServerActivities(
);
if ($response->object !== null) {
// handle response
}require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "<YOUR_API_KEY_HERE>",
),
)
res = s.activities.get_server_activities()
if ! res.object.nil?
# handle response
endpackage main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Activities.ListActivities(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListActivitiesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListActivitiesResponse res = sdk.activities().listActivities()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
token: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await plexAPI.activities.listActivities();
console.log(result);
}
run();curl --request GET \
--url https://{IP-description}.{identifier}.plex.direct:{port}/activities \
--header 'X-Plex-Token: <api-key>'import requests
url = "https://{IP-description}.{identifier}.plex.direct:{port}/activities"
headers = {"X-Plex-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Plex-Token': '<api-key>'}};
fetch('https://{IP-description}.{identifier}.plex.direct:{port}/activities', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"MediaContainer": {
"Activity": [
{
"cancellable": true,
"Context": {},
"progress": 49.5,
"Response": {},
"subtitle": "<string>",
"title": "<string>",
"type": "<string>",
"userID": 123,
"uuid": "<string>"
}
]
}
}Activities
Get all activities
List all activities on the server. Admins can see all activities but other users can only see their own
GET
/
activities
PlexPHP
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$response = $sdk->activities->getServerActivities(
);
if ($response->object !== null) {
// handle response
}require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "<YOUR_API_KEY_HERE>",
),
)
res = s.activities.get_server_activities()
if ! res.object.nil?
# handle response
endpackage main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Activities.ListActivities(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListActivitiesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListActivitiesResponse res = sdk.activities().listActivities()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
token: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await plexAPI.activities.listActivities();
console.log(result);
}
run();curl --request GET \
--url https://{IP-description}.{identifier}.plex.direct:{port}/activities \
--header 'X-Plex-Token: <api-key>'import requests
url = "https://{IP-description}.{identifier}.plex.direct:{port}/activities"
headers = {"X-Plex-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Plex-Token': '<api-key>'}};
fetch('https://{IP-description}.{identifier}.plex.direct:{port}/activities', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"MediaContainer": {
"Activity": [
{
"cancellable": true,
"Context": {},
"progress": 49.5,
"Response": {},
"subtitle": "<string>",
"title": "<string>",
"type": "<string>",
"userID": 123,
"uuid": "<string>"
}
]
}
}Authorizations
The token which identifies the user accessing the PMS. This can be either:
- A traditional access token obtained from plex.tv
- A JWT token obtained through the JWT authentication flow
JWT tokens provide better security with:
- Short-lived tokens (7 days expiration)
- Public-key cryptography (ED25519)
- Better clock synchronization
- Individual device revocation capability
Response
200 - application/json
OK
Show child attributes
Show child attributes
Was this page helpful?
⌘I