Files
plexphp/docs/sdks/server/README.md

12 KiB

Server

(server)

Overview

Operations against the Plex Media Server System.

Available Operations

getMediaProviders

Retrieves media providers and their features from the Plex server.

Example Usage

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->server->getMediaProviders(
    xPlexToken: 'CV5xoxjTpFKUzBTShsaf'
);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
xPlexToken string ✔️ An authentication token, obtained from plex.tv CV5xoxjTpFKUzBTShsaf

Response

?Operations\GetMediaProvidersResponse

Errors

Error Type Status Code Content Type
Errors\GetMediaProvidersBadRequest 400 application/json
Errors\GetMediaProvidersUnauthorized 401 application/json
Errors\SDKException 4XX, 5XX */*

getServerIdentity

This request is useful to determine if the server is online or offline

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use LukeHagar\Plex_API;

$sdk = Plex_API\PlexAPI::builder()->build();



$response = $sdk->server->getServerIdentity(

);

if ($response->object !== null) {
    // handle response
}

Response

?Operations\GetServerIdentityResponse

Errors

Error Type Status Code Content Type
Errors\GetServerIdentityRequestTimeout 408 application/json
Errors\SDKException 4XX, 5XX */*

getAvailableClients

Get Available Clients

Example Usage

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->server->getAvailableClients(

);

if ($response->object !== null) {
    // handle response
}

Response

?Operations\GetAvailableClientsResponse

Errors

Error Type Status Code Content Type
Errors\GetAvailableClientsBadRequest 400 application/json
Errors\GetAvailableClientsUnauthorized 401 application/json
Errors\SDKException 4XX, 5XX */*

getDevices

Get Devices

Example Usage

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->server->getDevices(

);

if ($response->object !== null) {
    // handle response
}

Response

?Operations\GetDevicesResponse

Errors

Error Type Status Code Content Type
Errors\GetDevicesBadRequest 400 application/json
Errors\GetDevicesUnauthorized 401 application/json
Errors\SDKException 4XX, 5XX */*

getMyPlexAccount

Returns MyPlex Account Information

Example Usage

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->server->getMyPlexAccount(

);

if ($response->object !== null) {
    // handle response
}

Response

?Operations\GetMyPlexAccountResponse

Errors

Error Type Status Code Content Type
Errors\GetMyPlexAccountBadRequest 400 application/json
Errors\GetMyPlexAccountUnauthorized 401 application/json
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\Operations;

$sdk = Plex_API\PlexAPI::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

$request = new Operations\GetResizedPhotoRequest(
    width: 110,
    height: 165,
    opacity: 100,
    blur: 20,
    minSize: Operations\MinSize::Zero,
    upscale: Operations\Upscale::One,
    url: '/library/metadata/49564/thumb/1654258204',
);

$response = $sdk->server->getResizedPhoto(
    request: $request
);

if ($response->statusCode === 200) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\GetResizedPhotoRequest ✔️ The request object to use for the request.

Response

?Operations\GetResizedPhotoResponse

Errors

Error Type Status Code Content Type
Errors\GetResizedPhotoBadRequest 400 application/json
Errors\GetResizedPhotoUnauthorized 401 application/json
Errors\SDKException 4XX, 5XX */*

getServerCapabilities

Get Server Capabilities

Example Usage

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->server->getServerCapabilities(

);

if ($response->object !== null) {
    // handle response
}

Response

?Operations\GetServerCapabilitiesResponse

Errors

Error Type Status Code Content Type
Errors\GetServerCapabilitiesBadRequest 400 application/json
Errors\GetServerCapabilitiesUnauthorized 401 application/json
Errors\SDKException 4XX, 5XX */*

getServerList

Get Server List

Example Usage

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->server->getServerList(

);

if ($response->object !== null) {
    // handle response
}

Response

?Operations\GetServerListResponse

Errors

Error Type Status Code Content Type
Errors\GetServerListBadRequest 400 application/json
Errors\GetServerListUnauthorized 401 application/json
Errors\SDKException 4XX, 5XX */*

getServerPreferences

Get Server Preferences

Example Usage

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->server->getServerPreferences(

);

if ($response->object !== null) {
    // handle response
}

Response

?Operations\GetServerPreferencesResponse

Errors

Error Type Status Code Content Type
Errors\GetServerPreferencesBadRequest 400 application/json
Errors\GetServerPreferencesUnauthorized 401 application/json
Errors\SDKException 4XX, 5XX */*