Server
Overview
Operations against the Plex Media Server System.
Available Operations
- getServerCapabilities - Server Capabilities
- getServerPreferences - Get Server Preferences
- getAvailableClients - Get Available Clients
- getDevices - Get Devices
- getServerIdentity - Get Server Identity
- getMyPlexAccount - Get MyPlex Account
- getResizedPhoto - Get a Resized Photo
- getServerList - Get Server List
getServerCapabilities
Server Capabilities
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getServerCapabilities();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Response
?\LukeHagar\Plex_API\Models\Operations\GetServerCapabilitiesResponse
getServerPreferences
Get Server Preferences
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getServerPreferences();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Response
?\LukeHagar\Plex_API\Models\Operations\GetServerPreferencesResponse
getAvailableClients
Get Available Clients
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getAvailableClients();
if ($response->responseBodies !== null) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Response
?\LukeHagar\Plex_API\Models\Operations\GetAvailableClientsResponse
getDevices
Get Devices
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getDevices();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Response
?\LukeHagar\Plex_API\Models\Operations\GetDevicesResponse
getServerIdentity
Get Server Identity
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getServerIdentity();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Response
?\LukeHagar\Plex_API\Models\Operations\GetServerIdentityResponse
getMyPlexAccount
Returns MyPlex Account Information
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getMyPlexAccount();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Response
?\LukeHagar\Plex_API\Models\Operations\GetMyPlexAccountResponse
getResizedPhoto
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
use \LukeHagar\Plex_API\Models\Operations;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$request = new Operations\GetResizedPhotoRequest();
$request->width = 110;
$request->height = 165;
$request->opacity = 643869;
$request->blur = 4000;
$request->minSize = Operations\MinSize::Zero;
$request->upscale = Operations\Upscale::Zero;
$request->url = '/library/metadata/49564/thumb/1654258204';;
$response = $sdk->server->getResizedPhoto($request);
if ($response->statusCode === 200) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
\LukeHagar\Plex_API\Models\Operations\GetResizedPhotoRequest | ✔️ | The request object to use for the request. |
Response
?\LukeHagar\Plex_API\Models\Operations\GetResizedPhotoResponse
getServerList
Get Server List
Example Usage
<?php
declare(strict_types=1);
require_once 'vendor/autoload.php';
use \LukeHagar\Plex_API;
use \LukeHagar\Plex_API\Models\Components;
$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$sdk = Plex_API\PlexAPI::builder()->setSecurity($security)->build();
try {
$response = $sdk->server->getServerList();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Exception $e) {
// handle exception
}
Response
?\LukeHagar\Plex_API\Models\Operations\GetServerListResponse