(statistics())
API Calls that perform operations with Plex Media Server Statistics
- getStatistics - Get Media Statistics
- getResourcesStatistics - Get Resources Statistics
- getBandwidthStatistics - Get Bandwidth Statistics
This will return the media statistics for the server
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.GetStatisticsBadRequest;
import dev.plexapi.sdk.models.errors.GetStatisticsUnauthorized;
import dev.plexapi.sdk.models.operations.GetStatisticsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws GetStatisticsBadRequest, GetStatisticsUnauthorized, Exception {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.build();
GetStatisticsResponse res = sdk.statistics().getStatistics()
.timespan(4L)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
timespan |
Optional<Long> | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
4 |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/GetStatisticsBadRequest | 400 | application/json |
models/errors/GetStatisticsUnauthorized | 401 | application/json |
models/errors/SDKError | 4XX, 5XX | */* |
This will return the resources for the server
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.GetResourcesStatisticsBadRequest;
import dev.plexapi.sdk.models.errors.GetResourcesStatisticsUnauthorized;
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws GetResourcesStatisticsBadRequest, GetResourcesStatisticsUnauthorized, Exception {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.build();
GetResourcesStatisticsResponse res = sdk.statistics().getResourcesStatistics()
.timespan(4L)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
timespan |
Optional<Long> | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
4 |
GetResourcesStatisticsResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/GetResourcesStatisticsBadRequest | 400 | application/json |
models/errors/GetResourcesStatisticsUnauthorized | 401 | application/json |
models/errors/SDKError | 4XX, 5XX | */* |
This will return the bandwidth statistics for the server
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.errors.GetBandwidthStatisticsBadRequest;
import dev.plexapi.sdk.models.errors.GetBandwidthStatisticsUnauthorized;
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws GetBandwidthStatisticsBadRequest, GetBandwidthStatisticsUnauthorized, Exception {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.build();
GetBandwidthStatisticsResponse res = sdk.statistics().getBandwidthStatistics()
.timespan(4L)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
timespan |
Optional<Long> | ➖ | The timespan to retrieve statistics for the exact meaning of this parameter is not known |
4 |
GetBandwidthStatisticsResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/GetBandwidthStatisticsBadRequest | 400 | application/json |
models/errors/GetBandwidthStatisticsUnauthorized | 401 | application/json |
models/errors/SDKError | 4XX, 5XX | */* |