mirror of
https://github.com/LukeHagar/plexphp.git
synced 2025-12-06 04:20:51 +00:00
12 KiB
12 KiB
Server
Overview
Operations against the Plex Media Server System.
Available Operations
- getServerCapabilities - Get 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
Get Server Capabilities
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->server->getServerCapabilities();
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Response
?Operations\GetServerCapabilitiesResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetServerCapabilitiesResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getServerPreferences
Get Server Preferences
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->server->getServerPreferences();
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Response
?Operations\GetServerPreferencesResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetServerPreferencesResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getAvailableClients
Get Available Clients
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->server->getAvailableClients();
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Response
?Operations\GetAvailableClientsResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetAvailableClientsResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getDevices
Get Devices
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->server->getDevices();
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Response
?Operations\GetDevicesResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetDevicesResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getServerIdentity
Get Server Identity
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->server->getServerIdentity();
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Response
?Operations\GetServerIdentityResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetServerIdentityResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getMyPlexAccount
Returns MyPlex Account Information
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->server->getMyPlexAccount();
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Response
?Operations\GetMyPlexAccountResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetMyPlexAccountResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getResizedPhoto
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$request = new Operations\GetResizedPhotoRequest(
width: 110,
height: 165,
opacity: 643869,
blur: 4000,
minSize: Operations\MinSize::Zero,
upscale: Operations\Upscale::Zero,
url: '/library/metadata/49564/thumb/1654258204',
);
$response = $sdk->server->getResizedPhoto($request);
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\GetResizedPhotoRequest | ✔️ | The request object to use for the request. |
Response
?Operations\GetResizedPhotoResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetResizedPhotoResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getServerList
Get Server List
Example Usage
declare(strict_types=1);
require '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()
->setXPlexClientIdentifier('Postman')
->setSecurity($security)->build();
try {
$response = $sdk->server->getServerList();
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Response
?Operations\GetServerListResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetServerListResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |