mirror of
https://github.com/LukeHagar/plexphp.git
synced 2025-12-06 04:20:51 +00:00
61 lines
2.1 KiB
Markdown
61 lines
2.1 KiB
Markdown
# Statistics
|
|
|
|
|
|
## Overview
|
|
|
|
API Calls that perform operations with Plex Media Server Statistics
|
|
|
|
|
|
### Available Operations
|
|
|
|
* [getStatistics](#getstatistics) - Get Media Statistics
|
|
|
|
## getStatistics
|
|
|
|
This will return the media statistics for the server
|
|
|
|
### Example Usage
|
|
|
|
```php
|
|
<?php
|
|
|
|
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('<value>')
|
|
->setSecurity($security)->build();
|
|
|
|
try {
|
|
|
|
|
|
$response = $sdk->statistics->getStatistics(411769);
|
|
|
|
if ($response->twoHundredApplicationJsonObject !== null) {
|
|
// handle response
|
|
}
|
|
} catch (Throwable $e) {
|
|
// handle exception
|
|
}
|
|
```
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
| `timespan` | *int* | :heavy_minus_sign: | The timespan to retrieve statistics for<br/>the exact meaning of this parameter is not known<br/> |
|
|
|
|
|
|
### Response
|
|
|
|
**[?\LukeHagar\Plex_API\Models\Operations\GetStatisticsResponse](../../Models/Operations/GetStatisticsResponse.md)**
|
|
|