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
}require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "<YOUR_API_KEY_HERE>",
),
)
res = s.server.get_media_providers(x_plex_token="CV5xoxjTpFKUzBTShsaf")
if ! res.object.nil?
# handle response
endpackage main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Provider.ListProviders(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListProvidersResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListProvidersResponse res = sdk.provider().listProviders()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
token: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await plexAPI.provider.listProviders();
console.log(result);
}
run();curl --request GET \
--url https://{IP-description}.{identifier}.plex.direct:{port}/media/providers \
--header 'X-Plex-Token: <api-key>'import requests
url = "https://{IP-description}.{identifier}.plex.direct:{port}/media/providers"
headers = {"X-Plex-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Plex-Token': '<api-key>'}};
fetch('https://{IP-description}.{identifier}.plex.direct:{port}/media/providers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"MediaContainer": {
"identifier": "<string>",
"offset": 123,
"size": 123,
"totalSize": 123,
"allowCameraUpload": true,
"allowChannelAccess": true,
"allowMediaDeletion": true,
"allowSharing": true,
"allowSync": true,
"allowTuners": true,
"backgroundProcessing": true,
"certificate": true,
"companionProxy": true,
"countryCode": "<string>",
"diagnostics": "<string>",
"eventStream": true,
"friendlyName": "<string>",
"hubSearch": true,
"itemClusters": true,
"livetv": 7,
"machineIdentifier": "<unknown>",
"mediaProviders": true,
"multiuser": true,
"musicAnalysis": 2,
"myPlex": true,
"myPlexMappingState": "<unknown>",
"myPlexSigninState": "<unknown>",
"myPlexSubscription": true,
"myPlexUsername": "<string>",
"offlineTranscode": "<unknown>",
"ownerFeatures": "<string>",
"platform": "<string>",
"platformVersion": "<string>",
"pluginHost": true,
"pushNotifications": true,
"readOnlyLibraries": true,
"streamingBrainABRVersion": 123,
"streamingBrainVersion": 123,
"sync": true,
"transcoderActiveVideoSessions": 123,
"transcoderAudio": true,
"transcoderLyrics": true,
"transcoderPhoto": true,
"transcoderSubtitles": true,
"transcoderVideo": true,
"transcoderVideoBitrates": "<unknown>",
"transcoderVideoQualities": "<string>",
"transcoderVideoResolutions": "<unknown>",
"updatedAt": 123,
"updater": true,
"version": "<string>",
"voiceSearch": true,
"Feature": [
{
"Directory": [
{
"title": "<string>",
"type": "<string>",
"art": "<string>",
"content": true,
"filter": "<string>",
"hasPrefs": true,
"hasStoreServices": true,
"hubKey": "<string>",
"identifier": "<string>",
"key": "<string>",
"lastAccessedAt": 123,
"Pivot": [
{
"title": "<string>",
"type": "<string>",
"context": "<string>",
"id": "<string>",
"key": "<string>",
"symbol": "<string>"
}
],
"share": 123,
"thumb": "<string>",
"titleBar": "<string>"
}
],
"key": "<string>",
"type": "<string>"
}
],
"protocols": "<string>",
"title": "<string>",
"types": "<string>"
}
}Get the list of available media providers
Get the list of all available media providers for this PMS. This will generally include the library provider and possibly EPG if DVR is set up.
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
}require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "<YOUR_API_KEY_HERE>",
),
)
res = s.server.get_media_providers(x_plex_token="CV5xoxjTpFKUzBTShsaf")
if ! res.object.nil?
# handle response
endpackage main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Provider.ListProviders(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListProvidersResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListProvidersResponse res = sdk.provider().listProviders()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
token: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await plexAPI.provider.listProviders();
console.log(result);
}
run();curl --request GET \
--url https://{IP-description}.{identifier}.plex.direct:{port}/media/providers \
--header 'X-Plex-Token: <api-key>'import requests
url = "https://{IP-description}.{identifier}.plex.direct:{port}/media/providers"
headers = {"X-Plex-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Plex-Token': '<api-key>'}};
fetch('https://{IP-description}.{identifier}.plex.direct:{port}/media/providers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"MediaContainer": {
"identifier": "<string>",
"offset": 123,
"size": 123,
"totalSize": 123,
"allowCameraUpload": true,
"allowChannelAccess": true,
"allowMediaDeletion": true,
"allowSharing": true,
"allowSync": true,
"allowTuners": true,
"backgroundProcessing": true,
"certificate": true,
"companionProxy": true,
"countryCode": "<string>",
"diagnostics": "<string>",
"eventStream": true,
"friendlyName": "<string>",
"hubSearch": true,
"itemClusters": true,
"livetv": 7,
"machineIdentifier": "<unknown>",
"mediaProviders": true,
"multiuser": true,
"musicAnalysis": 2,
"myPlex": true,
"myPlexMappingState": "<unknown>",
"myPlexSigninState": "<unknown>",
"myPlexSubscription": true,
"myPlexUsername": "<string>",
"offlineTranscode": "<unknown>",
"ownerFeatures": "<string>",
"platform": "<string>",
"platformVersion": "<string>",
"pluginHost": true,
"pushNotifications": true,
"readOnlyLibraries": true,
"streamingBrainABRVersion": 123,
"streamingBrainVersion": 123,
"sync": true,
"transcoderActiveVideoSessions": 123,
"transcoderAudio": true,
"transcoderLyrics": true,
"transcoderPhoto": true,
"transcoderSubtitles": true,
"transcoderVideo": true,
"transcoderVideoBitrates": "<unknown>",
"transcoderVideoQualities": "<string>",
"transcoderVideoResolutions": "<unknown>",
"updatedAt": 123,
"updater": true,
"version": "<string>",
"voiceSearch": true,
"Feature": [
{
"Directory": [
{
"title": "<string>",
"type": "<string>",
"art": "<string>",
"content": true,
"filter": "<string>",
"hasPrefs": true,
"hasStoreServices": true,
"hubKey": "<string>",
"identifier": "<string>",
"key": "<string>",
"lastAccessedAt": 123,
"Pivot": [
{
"title": "<string>",
"type": "<string>",
"context": "<string>",
"id": "<string>",
"key": "<string>",
"symbol": "<string>"
}
],
"share": 123,
"thumb": "<string>",
"titleBar": "<string>"
}
],
"key": "<string>",
"type": "<string>"
}
],
"protocols": "<string>",
"title": "<string>",
"types": "<string>"
}
}Authorizations
The token which identifies the user accessing the PMS. This can be either:
- A traditional access token obtained from plex.tv
- A JWT token obtained through the JWT authentication flow
JWT tokens provide better security with:
- Short-lived tokens (7 days expiration)
- Public-key cryptography (ED25519)
- Better clock synchronization
- Individual device revocation capability
Response
OK
MediaContainer is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.
Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)
The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the parentTitle attribute may appear on the MediaContainer rather than being repeated on each track.
Show child attributes
Show child attributes
Was this page helpful?