mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 12:37:46 +00:00
Statistics
(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
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.statistics.getStatistics(4);
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
timespan |
number | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
[object Object] |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
Response
Promise<models.GetStatisticsResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| models.GetStatisticsStatisticsResponseBody | 401 | application/json |
| models.SDKError | 4xx-5xx | / |
getResourcesStatistics
This will return the resources for the server
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.statistics.getResourcesStatistics(4);
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
timespan |
number | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
[object Object] |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
Response
Promise<models.GetResourcesStatisticsResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| models.GetResourcesStatisticsStatisticsResponseBody | 401 | application/json |
| models.SDKError | 4xx-5xx | / |
getBandwidthStatistics
This will return the bandwidth statistics for the server
Example Usage
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.statistics.getBandwidthStatistics(4);
// Handle the result
console.log(result)
}
run();
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
timespan |
number | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
[object Object] |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. | |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
Response
Promise<models.GetBandwidthStatisticsResponse>
Errors
| Error Object | Status Code | Content Type |
|---|---|---|
| models.GetBandwidthStatisticsStatisticsResponseBody | 401 | application/json |
| models.SDKError | 4xx-5xx | / |