mirror of
https://github.com/LukeHagar/plexphp.git
synced 2025-12-06 04:20:51 +00:00
8.4 KiB
8.4 KiB
Statistics
Overview
API Calls that perform operations with Plex Media Server Statistics
Available Operations
- getStatistics - Get Media Statistics
- getResourcesStatistics - Get Resources Statistics
- getBandwidthStatistics - Get Bandwidth Statistics
getStatistics
This will return the media statistics for the server
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->statistics->getStatistics(4);
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
timespan |
int | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
4 |
Response
?Operations\GetStatisticsResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetStatisticsResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getResourcesStatistics
This will return the resources for the server
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->statistics->getResourcesStatistics(4);
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
timespan |
int | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
4 |
Response
?Operations\GetResourcesStatisticsResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetResourcesStatisticsResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |
getBandwidthStatistics
This will return the bandwidth statistics for the server
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->statistics->getBandwidthStatistics(4);
if ($response->object !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
timespan |
int | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
4 |
Response
?Operations\GetBandwidthStatisticsResponse
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| Errors\GetBandwidthStatisticsResponseBody | 401 | application/json |
| LukeHagar\Plex_API\Models\Errors.SDKException | 4xx-5xx | / |