Files
plex-mintlify-docs/openapi-with-code-samples.yaml
2024-07-01 16:36:02 +00:00

15540 lines
634 KiB
YAML

components:
securitySchemes:
accessToken:
description: Plex Authentication Token
in: header
name: X-Plex-Token
type: apiKey
info:
contact:
email: Lukeslakemail@gmail.com
name: Luke Hagar
url: https://www.LukeHagar.com
description: An Open API Spec for interacting with Plex.tv and Plex Servers
license:
identifier: MIT
name: MIT
summary: A Plex Media Server API Map
title: Plex-API
version: 0.0.3
openapi: 3.1.0
paths:
/:
get:
description: Get Server Capabilities
operationId: getServerCapabilities
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Directory:
items:
properties:
count:
type: number
key:
type: string
title:
type: string
type: object
type: array
allowCameraUpload:
type: boolean
allowChannelAccess:
type: boolean
allowMediaDeletion:
type: boolean
allowSharing:
type: boolean
allowSync:
type: boolean
allowTuners:
type: boolean
backgroundProcessing:
type: boolean
certificate:
type: boolean
companionProxy:
type: boolean
countryCode:
type: string
diagnostics:
type: string
eventStream:
type: boolean
friendlyName:
type: string
hubSearch:
type: boolean
itemClusters:
type: boolean
livetv:
type: number
machineIdentifier:
type: string
mediaProviders:
type: boolean
multiuser:
type: boolean
musicAnalysis:
type: number
myPlex:
type: boolean
myPlexMappingState:
type: string
myPlexSigninState:
type: string
myPlexSubscription:
type: boolean
myPlexUsername:
type: string
offlineTranscode:
type: number
ownerFeatures:
type: string
photoAutoTag:
type: boolean
platform:
type: string
platformVersion:
type: string
pluginHost:
type: boolean
pushNotifications:
type: boolean
readOnlyLibraries:
type: boolean
size:
type: number
streamingBrainABRVersion:
type: number
streamingBrainVersion:
type: number
sync:
type: boolean
transcoderActiveVideoSessions:
type: number
transcoderAudio:
type: boolean
transcoderLyrics:
type: boolean
transcoderPhoto:
type: boolean
transcoderSubtitles:
type: boolean
transcoderVideo:
type: boolean
transcoderVideoBitrates:
type: string
transcoderVideoQualities:
type: string
transcoderVideoResolutions:
type: string
updatedAt:
type: number
updater:
type: boolean
version:
type: string
voiceSearch:
type: boolean
type: object
type: object
description: The Server Capabilities
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Server Capabilities
tags:
- Server
x-codeSamples:
- label: getServerCapabilities
lang: php
source: |-
<?php
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->server->getServerCapabilities();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getServerCapabilities
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.server.get_server_capabilities()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getServerCapabilities
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Server.GetServerCapabilities(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getServerCapabilities
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetServerCapabilitiesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getServerCapabilities
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getServerCapabilities();
// Handle the result
console.log(result)
}
run();
/:/prefs:
get:
description: Get Server Preferences
operationId: getServerPreferences
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Setting:
items:
properties:
advanced:
example: false
type: boolean
default:
example: false
type: boolean
enumValues:
example: 1:admin only|2:everyone
type: string
group:
example: ""
type: string
hidden:
example: true
type: boolean
id:
example: EnableDatabaseTrace
type: string
label:
example: ""
type: string
summary:
example: ""
type: string
type:
example: bool
type: string
value:
example: false
type: boolean
type: object
type: array
size:
example: 161
format: int32
type: integer
type: object
type: object
description: Server Preferences
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Server Preferences
tags:
- Server
x-codeSamples:
- label: getServerPreferences
lang: php
source: |-
<?php
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->server->getServerPreferences();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getServerPreferences
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.server.get_server_preferences()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getServerPreferences
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Server.GetServerPreferences(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getServerPreferences
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetServerPreferencesResponse res = sdk.server().getServerPreferences()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetServerPreferencesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getServerPreferences
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getServerPreferences();
// Handle the result
console.log(result)
}
run();
/:/progress:
post:
description: |
This API command can be used to update the play progress of a media item.
operationId: updatePlayProgress
parameters:
- description: the media key
in: query
name: key
required: true
schema:
type: string
- description: The time, in milliseconds, used to set the media playback progress.
example: 90000
in: query
name: time
required: true
schema:
type: number
- description: The playback state of the media item.
example: played
in: query
name: state
required: true
schema:
type: string
responses:
"200":
description: Success - The request was successful.
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Update Media Play Progress
tags:
- Media
x-codeSamples:
- label: updatePlayProgress
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->media->updatePlayProgress('<value>', 90000, 'played');\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: updatePlayProgress
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.media.update_play_progress(key=\"<value>\", time=90000.0, state=\"played\")\n\nif res.status_code == 200\n # handle response\nend"
- label: updatePlayProgress
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var key string = "<value>"
var time float64 = 90000
var state string = "played"
ctx := context.Background()
res, err := s.Media.UpdatePlayProgress(ctx, key, time, state)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: updatePlayProgress
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
UpdatePlayProgressResponse res = sdk.media().updatePlayProgress()
.key("<value>")
.time(90000d)
.state("played")
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.UpdatePlayProgressResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: updatePlayProgress
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.media.updatePlayProgress("<value>", 90000, "played");
// Handle the result
console.log(result)
}
run();
/:/scrobble:
get:
description: This will mark the provided media key as Played.
operationId: markPlayed
parameters:
- description: The media key to mark as played
in: query
name: key
required: true
schema:
example: 59398
type: number
responses:
"200":
description: Media is marked Played
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Mark Media Played
tags:
- Media
x-codeSamples:
- label: markPlayed
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->media->markPlayed(59398);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: markPlayed
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.media.mark_played(key=59398.0)\n\nif res.status_code == 200\n # handle response\nend"
- label: markPlayed
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var key float64 = 59398
ctx := context.Background()
res, err := s.Media.MarkPlayed(ctx, key)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: markPlayed
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
MarkPlayedResponse res = sdk.media().markPlayed()
.key(59398d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.MarkPlayedResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: markPlayed
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.media.markPlayed(59398);
// Handle the result
console.log(result)
}
run();
/:/timeline:
get:
description: Get the timeline for a media item
operationId: getTimeline
parameters:
- description: The rating key of the media item
example: 23409
in: query
name: ratingKey
required: true
schema:
type: number
- description: The key of the media item to get the timeline for
example: /library/metadata/23409
in: query
name: key
required: true
schema:
type: string
- description: The state of the media item
example: playing
in: query
name: state
required: true
schema:
enum:
- playing
- paused
- stopped
type: string
- description: Whether the media item has MDE
example: 1
in: query
name: hasMDE
required: true
schema:
type: number
- description: The time of the media item
example: 2000
in: query
name: time
required: true
schema:
type: number
- description: The duration of the media item
example: 10000
in: query
name: duration
required: true
schema:
type: number
- description: The context of the media item
example: home:hub.continueWatching
in: query
name: context
required: true
schema:
type: string
- description: The play queue item ID of the media item
example: 1
in: query
name: playQueueItemID
required: true
schema:
type: number
- description: The playback time of the media item
example: 2000
in: query
name: playBackTime
required: true
schema:
type: number
- description: The row of the media item
example: 1
in: query
name: row
required: true
schema:
type: number
responses:
"200":
description: The timeline for the media item
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get the timeline for a media item
tags:
- Video
x-codeSamples:
- label: getTimeline
lang: php
source: |-
<?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('Postman')
->setSecurity($security)->build();
try {
$request = new Operations\GetTimelineRequest();
$request->ratingKey = 23409;
$request->key = '/library/metadata/23409';
$request->state = Operations\State::Playing;
$request->hasMDE = 1;
$request->time = 2000;
$request->duration = 10000;
$request->context = 'home:hub.continueWatching';
$request->playQueueItemID = 1;
$request->playBackTime = 2000;
$request->row = 1;;
$response = $sdk->video->getTimeline($request);
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getTimeline
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n\nreq = ::OpenApiSDK::Operations::GetTimelineRequest.new(\n rating_key: 23409.0,\n key: \"/library/metadata/23409\",\n state: ::OpenApiSDK::Operations::State::PLAYING,\n has_mde: 1.0,\n time: 2000.0,\n duration: 10000.0,\n context: \"home:hub.continueWatching\",\n play_queue_item_id: 1.0,\n play_back_time: 2000.0,\n row: 1.0,\n)\n \nres = s.video.get_timeline(req)\n\nif res.status_code == 200\n # handle response\nend"
- label: getTimeline
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
request := operations.GetTimelineRequest{
RatingKey: 23409,
Key: "/library/metadata/23409",
State: operations.StatePlaying,
HasMDE: 1,
Time: 2000,
Duration: 10000,
Context: "home:hub.continueWatching",
PlayQueueItemID: 1,
PlayBackTime: 2000,
Row: 1,
}
ctx := context.Background()
res, err := s.Video.GetTimeline(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: getTimeline
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetTimelineRequest req = GetTimelineRequest.builder()
.ratingKey(23409d)
.key("/library/metadata/23409")
.state(State.PLAYING)
.hasMDE(1d)
.time(2000d)
.duration(10000d)
.context("home:hub.continueWatching")
.playQueueItemID(1d)
.playBackTime(2000d)
.row(1d)
.build();
GetTimelineResponse res = sdk.video().getTimeline()
.request(req)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.GetTimelineResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getTimeline
lang: typescript
source: |-
import { PlexAPI, State } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.video.getTimeline({
ratingKey: 23409,
key: "/library/metadata/23409",
state: State.Playing,
hasMDE: 1,
time: 2000,
duration: 10000,
context: "home:hub.continueWatching",
playQueueItemID: 1,
playBackTime: 2000,
row: 1,
});
// Handle the result
console.log(result)
}
run();
/:/unscrobble:
get:
description: This will mark the provided media key as Unplayed.
operationId: markUnplayed
parameters:
- description: The media key to mark as Unplayed
in: query
name: key
required: true
schema:
example: 59398
type: number
responses:
"200":
description: Media is marked Unplayed
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Mark Media Unplayed
tags:
- Media
x-codeSamples:
- label: markUnplayed
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->media->markUnplayed(59398);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: markUnplayed
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.media.mark_unplayed(key=59398.0)\n\nif res.status_code == 200\n # handle response\nend"
- label: markUnplayed
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var key float64 = 59398
ctx := context.Background()
res, err := s.Media.MarkUnplayed(ctx, key)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: markUnplayed
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
MarkUnplayedResponse res = sdk.media().markUnplayed()
.key(59398d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.MarkUnplayedResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: markUnplayed
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.media.markUnplayed(59398);
// Handle the result
console.log(result)
}
run();
/activities:
get:
description: Get Server Activities
operationId: getServerActivities
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Activity:
items:
properties:
Context:
properties:
librarySectionID:
type: string
type: object
cancellable:
type: boolean
progress:
type: number
subtitle:
type: string
title:
type: string
type:
type: string
userID:
type: number
uuid:
type: string
type: object
type: array
size:
type: number
type: object
type: object
description: The Server Activities
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Server Activities
tags:
- Activities
x-codeSamples:
- label: getServerActivities
lang: php
source: |-
<?php
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->activities->getServerActivities();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getServerActivities
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.activities.get_server_activities()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getServerActivities
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Activities.GetServerActivities(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getServerActivities
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetServerActivitiesResponse res = sdk.activities().getServerActivities()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetServerActivitiesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getServerActivities
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.activities.getServerActivities();
// Handle the result
console.log(result)
}
run();
/activities/{activityUUID}:
delete:
description: Cancel Server Activities
operationId: cancelServerActivities
parameters:
- description: The UUID of the activity to cancel.
example: 25b71ed5-0f9d-461c-baa7-d404e9e10d3e
in: path
name: activityUUID
required: true
schema:
type: string
responses:
"200":
description: The Server Activity was canceled
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Cancel Server Activities
tags:
- Activities
x-codeSamples:
- label: cancelServerActivities
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->activities->cancelServerActivities('25b71ed5-0f9d-461c-baa7-d404e9e10d3e');\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: cancelServerActivities
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.activities.cancel_server_activities(activity_uuid=\"25b71ed5-0f9d-461c-baa7-d404e9e10d3e\")\n\nif res.status_code == 200\n # handle response\nend"
- label: cancelServerActivities
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var activityUUID string = "25b71ed5-0f9d-461c-baa7-d404e9e10d3e"
ctx := context.Background()
res, err := s.Activities.CancelServerActivities(ctx, activityUUID)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: cancelServerActivities
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
CancelServerActivitiesResponse res = sdk.activities().cancelServerActivities()
.activityUUID("25b71ed5-0f9d-461c-baa7-d404e9e10d3e")
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.CancelServerActivitiesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: cancelServerActivities
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.activities.cancelServerActivities("25b71ed5-0f9d-461c-baa7-d404e9e10d3e");
// Handle the result
console.log(result)
}
run();
/butler:
delete:
description: |
This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
operationId: stopAllTasks
responses:
"200":
description: All tasks were stopped
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Stop all Butler tasks
tags:
- Butler
x-codeSamples:
- label: stopAllTasks
lang: php
source: |-
<?php
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->butler->stopAllTasks();
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: stopAllTasks
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.butler.stop_all_tasks()\n\nif res.status_code == 200\n # handle response\nend"
- label: stopAllTasks
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Butler.StopAllTasks(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: stopAllTasks
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
StopAllTasksResponse res = sdk.butler().stopAllTasks()
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.StopAllTasksResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: stopAllTasks
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.butler.stopAllTasks();
// Handle the result
console.log(result)
}
run();
get:
description: Returns a list of butler tasks
operationId: getButlerTasks
responses:
"200":
content:
application/json:
schema:
properties:
ButlerTasks:
properties:
ButlerTask:
items:
properties:
description:
example: Create a backup copy of the server's database in the configured backup directory
type: string
enabled:
type: boolean
interval:
example: 3
type: number
name:
example: BackupDatabase
type: string
scheduleRandomized:
type: boolean
title:
example: Backup Database
type: string
type: object
type: array
type: object
type: object
description: All butler tasks
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Butler tasks
tags:
- Butler
x-codeSamples:
- label: getButlerTasks
lang: php
source: |-
<?php
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->butler->getButlerTasks();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getButlerTasks
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.butler.get_butler_tasks()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getButlerTasks
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Butler.GetButlerTasks(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getButlerTasks
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetButlerTasksResponse res = sdk.butler().getButlerTasks()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetButlerTasksResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getButlerTasks
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.butler.getButlerTasks();
// Handle the result
console.log(result)
}
run();
post:
description: |
This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
1. Any tasks not scheduled to run on the current day will be skipped.
2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
4. If we are outside the configured window, the task will start immediately.
operationId: startAllTasks
responses:
"200":
description: All tasks were started
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Start all Butler tasks
tags:
- Butler
x-codeSamples:
- label: startAllTasks
lang: php
source: |-
<?php
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->butler->startAllTasks();
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: startAllTasks
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.butler.start_all_tasks()\n\nif res.status_code == 200\n # handle response\nend"
- label: startAllTasks
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Butler.StartAllTasks(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: startAllTasks
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
StartAllTasksResponse res = sdk.butler().startAllTasks()
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.StartAllTasksResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: startAllTasks
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.butler.startAllTasks();
// Handle the result
console.log(result)
}
run();
/butler/{taskName}:
delete:
description: |
This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint.
operationId: stopTask
parameters:
- description: The name of the task to be started.
in: path
name: taskName
required: true
schema:
enum:
- BackupDatabase
- BuildGracenoteCollections
- CheckForUpdates
- CleanOldBundles
- CleanOldCacheFiles
- DeepMediaAnalysis
- GenerateAutoTags
- GenerateChapterThumbs
- GenerateMediaIndexFiles
- OptimizeDatabase
- RefreshLibraries
- RefreshLocalMedia
- RefreshPeriodicMetadata
- UpgradeMediaAnalysis
type: string
responses:
"200":
description: The task was stopped
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
"404":
description: The task was not running
summary: Stop a single Butler task
tags:
- Butler
x-codeSamples:
- label: stopTask
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->butler->stopTask(Operations\\PathParamTaskName::BackupDatabase);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: stopTask
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.butler.stop_task(task_name=::OpenApiSDK::Operations::PathParamTaskName::BACKUP_DATABASE)\n\nif res.status_code == 200\n # handle response\nend"
- label: stopTask
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var taskName operations.PathParamTaskName = operations.PathParamTaskNameBackupDatabase
ctx := context.Background()
res, err := s.Butler.StopTask(ctx, taskName)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: stopTask
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
StopTaskResponse res = sdk.butler().stopTask()
.taskName(PathParamTaskName.BACKUP_DATABASE)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.StopTaskResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: stopTask
lang: typescript
source: |-
import { PathParamTaskName, PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.butler.stopTask(PathParamTaskName.BackupDatabase);
// Handle the result
console.log(result)
}
run();
post:
description: |
This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
1. Any tasks not scheduled to run on the current day will be skipped.
2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
4. If we are outside the configured window, the task will start immediately.
operationId: startTask
parameters:
- description: the name of the task to be started.
in: path
name: taskName
required: true
schema:
enum:
- BackupDatabase
- BuildGracenoteCollections
- CheckForUpdates
- CleanOldBundles
- CleanOldCacheFiles
- DeepMediaAnalysis
- GenerateAutoTags
- GenerateChapterThumbs
- GenerateMediaIndexFiles
- OptimizeDatabase
- RefreshLibraries
- RefreshLocalMedia
- RefreshPeriodicMetadata
- UpgradeMediaAnalysis
type: string
responses:
"200":
description: The task was started successfully
"202":
description: The task was already running.
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Start a single Butler task
tags:
- Butler
x-codeSamples:
- label: startTask
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->butler->startTask(Operations\\TaskName::CleanOldBundles);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: startTask
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.butler.start_task(task_name=::OpenApiSDK::Operations::TaskName::CLEAN_OLD_BUNDLES)\n\nif res.status_code == 200\n # handle response\nend"
- label: startTask
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var taskName operations.TaskName = operations.TaskNameCleanOldBundles
ctx := context.Background()
res, err := s.Butler.StartTask(ctx, taskName)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: startTask
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
StartTaskResponse res = sdk.butler().startTask()
.taskName(TaskName.CLEAN_OLD_BUNDLES)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.StartTaskResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: startTask
lang: typescript
source: |-
import { PlexAPI, TaskName } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.butler.startTask(TaskName.CleanOldBundles);
// Handle the result
console.log(result)
}
run();
/clients:
get:
description: Get Available Clients
operationId: getAvailableClients
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Server:
items:
properties:
address:
example: 10.10.10.102
type: string
deviceClass:
example: tablet
type: string
host:
example: 10.10.10.102
type: string
machineIdentifier:
example: A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05
type: string
name:
example: iPad
type: string
port:
example: 32500
type: number
product:
example: Plex for iOS
type: string
protocol:
example: plex
type: string
protocolCapabilities:
example: playback,playqueues,timeline,provider-playback
type: string
protocolVersion:
example: 2
type: number
version:
example: "8.17"
type: string
type: object
type: array
size:
example: 1
type: number
type: object
type: object
description: Available Clients
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Available Clients
tags:
- Server
x-codeSamples:
- label: getAvailableClients
lang: php
source: |-
<?php
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->server->getAvailableClients();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getAvailableClients
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.server.get_available_clients()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getAvailableClients
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Server.GetAvailableClients(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getAvailableClients
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetAvailableClientsResponse res = sdk.server().getAvailableClients()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetAvailableClientsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getAvailableClients
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getAvailableClients();
// Handle the result
console.log(result)
}
run();
/devices:
get:
description: Get Devices
operationId: getDevices
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Device:
items:
properties:
clientIdentifier:
type: string
createdAt:
example: 1654131230
type: number
id:
example: 1
type: number
name:
example: iPhone
type: string
platform:
example: iOS
type: string
type: object
type: array
identifier:
example: com.plexapp.system.devices
type: string
size:
example: 151
type: number
type: object
type: object
description: Devices
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Devices
tags:
- Server
x-codeSamples:
- label: getDevices
lang: php
source: |-
<?php
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->server->getDevices();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getDevices
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.server.get_devices()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getDevices
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Server.GetDevices(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getDevices
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetDevicesResponse res = sdk.server().getDevices()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetDevicesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getDevices
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getDevices();
// Handle the result
console.log(result)
}
run();
/home:
get:
description: Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.
operationId: getHomeData
responses:
"200":
content:
application/json:
schema:
properties:
guestEnabled:
type: boolean
guestUserID:
example: 58815432
type: number
guestUserUUID:
example: f3df4e01bfca0787
type: string
id:
example: 1841489
type: number
name:
example: Blindkitty38's home
type: string
subscription:
type: boolean
type: object
description: Home Data
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Plex Home Data
tags:
- Plex
x-codeSamples:
- label: getHomeData
lang: php
source: |-
<?php
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->plex->getHomeData();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getHomeData
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.plex.get_home_data()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getHomeData
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Plex.GetHomeData(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getHomeData
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetHomeDataResponse res = sdk.plex().getHomeData()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetHomeDataResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getHomeData
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.plex.getHomeData();
// Handle the result
console.log(result)
}
run();
/hubs:
get:
description: Get Global Hubs filtered by the parameters provided.
operationId: getGlobalHubs
parameters:
- description: The number of items to return with each hub.
in: query
name: count
required: false
schema:
type: number
- description: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
in: query
name: onlyTransient
required: false
schema:
enum:
- 0
- 1
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Hub:
items:
properties:
Metadata:
items:
properties:
addedAt:
example: 1668779618
format: int32
type: integer
composite:
example: /playlists/57070/composite/1668787730
type: string
duration:
example: 16873000
format: int32
type: integer
guid:
example: com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c
type: string
icon:
example: playlist://image.smart
type: string
key:
example: /playlists/57070/items
type: string
lastViewedAt:
example: 1668787732
format: int32
type: integer
leafCount:
example: 3
format: int32
type: integer
playlistType:
example: video
type: string
ratingKey:
example: "57070"
type: string
smart:
example: false
type: boolean
summary:
example: ""
type: string
title:
example: November Movie Day
type: string
titleSort:
example: Tracks
type: string
type:
example: playlist
type: string
updatedAt:
example: 1668787730
format: int32
type: integer
viewCount:
example: 2
format: int32
type: integer
type: object
type: array
context:
example: hub.home.playlists
type: string
hubIdentifier:
example: home.playlists
type: string
hubKey:
example: /library/metadata/50768,65523,58188,57341,57302,57070
type: string
key:
example: /playlists/all?type=15&sort=lastViewedAt:desc&playlistType=video,audio
type: string
more:
example: true
type: boolean
promoted:
example: true
type: boolean
size:
example: 6
format: int32
type: integer
style:
example: shelf
type: string
title:
example: Recent Playlists
type: string
type:
example: playlist
type: string
type: object
type: array
allowSync:
example: true
type: boolean
identifier:
example: com.plexapp.plugins.library
type: string
size:
example: 8
format: int32
type: integer
type: object
type: object
description: returns global hubs
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Global Hubs
tags:
- Hubs
x-codeSamples:
- label: getGlobalHubs
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->hubs->getGlobalHubs(1262.49, Operations\\OnlyTransient::One);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getGlobalHubs
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.hubs.get_global_hubs(count=1262.49, only_transient=::OpenApiSDK::Operations::OnlyTransient::ONE)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getGlobalHubs
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var count *float64 = plexgo.Float64(1262.49)
var onlyTransient *operations.OnlyTransient = operations.OnlyTransientOne.ToPointer()
ctx := context.Background()
res, err := s.Hubs.GetGlobalHubs(ctx, count, onlyTransient)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getGlobalHubs
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetGlobalHubsResponse res = sdk.hubs().getGlobalHubs()
.count(1262.49d)
.onlyTransient(OnlyTransient.ONE)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetGlobalHubsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getGlobalHubs
lang: typescript
source: |-
import { OnlyTransient, PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.hubs.getGlobalHubs(1262.49, OnlyTransient.One);
// Handle the result
console.log(result)
}
run();
/hubs/search:
get:
description: |
This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).
In the response's items, the following extra attributes are returned to further describe or disambiguate the result:
- `reason`: The reason for the result, if not because of a direct search term match; can be either:
- `section`: There are multiple identical results from different sections.
- `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language).
- `<hub identifier>`: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor`
- `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold").
- `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID.
This request is intended to be very fast, and called as the user types.
operationId: performSearch
parameters:
- description: The query term
in: query
name: query
required: true
schema:
examples:
- arnold
- dylan
type: string
- description: This gives context to the search, and can result in re-ordering of search result hubs
in: query
name: sectionId
required: false
schema:
type: number
- description: The number of items to return per hub
in: query
name: limit
schema:
default: 3
example: 5
type: number
responses:
"200":
description: The search results
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Perform a search
tags:
- Search
x-codeSamples:
- label: performSearch
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->search->performSearch('dylan', 1516.53, 5);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: performSearch
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.search.perform_search(query=\"dylan\", section_id=1516.53, limit=5.0)\n\nif res.status_code == 200\n # handle response\nend"
- label: performSearch
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var query string = "dylan"
var sectionID *float64 = plexgo.Float64(1516.53)
var limit *float64 = plexgo.Float64(5)
ctx := context.Background()
res, err := s.Search.PerformSearch(ctx, query, sectionID, limit)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: performSearch
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
PerformSearchResponse res = sdk.search().performSearch()
.query("dylan")
.sectionId(1516.53d)
.limit(5d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.PerformSearchResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: performSearch
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.search.performSearch("dylan", 1516.53, 5);
// Handle the result
console.log(result)
}
run();
/hubs/search/voice:
get:
description: "This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint. \nIt uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint. \nWhenever possible, clients should limit the search to the appropriate type. \nResults, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.\n"
operationId: performVoiceSearch
parameters:
- description: The query term
in: query
name: query
required: true
schema:
examples:
- dead+poop
type: string
- description: This gives context to the search, and can result in re-ordering of search result hubs
in: query
name: sectionId
required: false
schema:
type: number
- description: The number of items to return per hub
in: query
name: limit
required: false
schema:
default: 3
example: 5
type: number
responses:
"200":
description: The search results
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Perform a voice search
tags:
- Search
x-codeSamples:
- label: performVoiceSearch
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->search->performVoiceSearch('dead+poop', 4094.8, 5);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: performVoiceSearch
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.search.perform_voice_search(query=\"dead+poop\", section_id=4094.8, limit=5.0)\n\nif res.status_code == 200\n # handle response\nend"
- label: performVoiceSearch
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var query string = "dead+poop"
var sectionID *float64 = plexgo.Float64(4094.8)
var limit *float64 = plexgo.Float64(5)
ctx := context.Background()
res, err := s.Search.PerformVoiceSearch(ctx, query, sectionID, limit)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: performVoiceSearch
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
PerformVoiceSearchResponse res = sdk.search().performVoiceSearch()
.query("dead+poop")
.sectionId(4094.8d)
.limit(5d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.PerformVoiceSearchResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: performVoiceSearch
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.search.performVoiceSearch("dead+poop", 4094.8, 5);
// Handle the result
console.log(result)
}
run();
/hubs/sections/{sectionId}:
get:
description: |
This endpoint will return a list of library specific hubs
operationId: getLibraryHubs
parameters:
- description: the Id of the library to query
in: path
name: sectionId
required: true
schema:
type: number
- description: The number of items to return with each hub.
in: query
name: count
required: false
schema:
type: number
- description: Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
in: query
name: onlyTransient
required: false
schema:
enum:
- 0
- 1
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Hub:
items:
properties:
Metadata:
items:
properties:
Country:
items:
properties:
tag:
example: United States of America
type: string
type: object
type: array
Director:
items:
properties:
tag:
example: Nathan Greno
type: string
type: object
type: array
Genre:
items:
properties:
tag:
example: Animation
type: string
type: object
type: array
Media:
items:
properties:
Part:
items:
properties:
audioProfile:
example: lc
type: string
container:
example: mp4
type: string
duration:
example: 6017237
format: int32
type: integer
file:
example: /movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4
type: string
has64bitOffsets:
example: false
type: boolean
id:
example: 38247
format: int32
type: integer
key:
example: /library/parts/38247/1589412494/file.mp4
type: string
optimizedForStreaming:
example: true
type: boolean
size:
example: 1545647447
format: int32
type: integer
videoProfile:
example: high
type: string
type: object
type: array
aspectRatio:
example: 1.78
type: number
audioChannels:
example: 2
format: int32
type: integer
audioCodec:
example: aac
type: string
audioProfile:
example: lc
type: string
bitrate:
example: 2051
format: int32
type: integer
container:
example: mp4
type: string
duration:
example: 6017237
format: int32
type: integer
has64bitOffsets:
example: false
type: boolean
height:
example: 1080
format: int32
type: integer
id:
example: 38247
format: int32
type: integer
optimizedForStreaming:
example: 1
format: int32
type: integer
videoCodec:
example: h264
type: string
videoFrameRate:
example: 24p
type: string
videoProfile:
example: high
type: string
videoResolution:
example: "1080"
type: string
width:
example: 1920
format: int32
type: integer
type: object
type: array
Role:
items:
properties:
tag:
example: Donna Murphy
type: string
type: object
type: array
Writer:
items:
properties:
tag:
example: Wilhelm Grimm
type: string
type: object
type: array
addedAt:
example: 1589412494
format: int32
type: integer
art:
example: /library/metadata/14944/art/1705739847
type: string
audienceRating:
example: 8.7
type: number
audienceRatingImage:
example: rottentomatoes://image.rating.upright
type: string
chapterSource:
example: media
type: string
contentRating:
example: PG
type: string
duration:
example: 6017237
format: int32
type: integer
guid:
example: plex://movie/5d77686eeb5d26001f1eb339
type: string
key:
example: /library/metadata/14944
type: string
lastViewedAt:
example: 1704936047
format: int32
type: integer
librarySectionID:
example: 1
format: int32
type: integer
librarySectionKey:
example: /library/sections/1
type: string
librarySectionTitle:
example: Movies
type: string
originallyAvailableAt:
example: 2010-11-24T00:00:00Z
format: date
type: string
primaryExtraKey:
example: /library/metadata/14952
type: string
rating:
example: 8.9
type: number
ratingImage:
example: rottentomatoes://image.rating.ripe
type: string
ratingKey:
example: "14944"
type: string
skipCount:
example: 1
format: int32
type: integer
studio:
example: Walt Disney Animation Studios
type: string
summary:
example: The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.
type: string
tagline:
example: They're taking adventure to new lengths.
type: string
thumb:
example: /library/metadata/14944/thumb/1705739847
type: string
title:
example: Tangled
type: string
type:
example: movie
type: string
updatedAt:
example: 1705739847
format: int32
type: integer
viewCount:
example: 1
format: int32
type: integer
year:
example: 2010
format: int32
type: integer
type: object
type: array
context:
example: hub.movie.recentlyviewed
type: string
hubIdentifier:
example: movie.recentlyviewed.1
type: string
hubKey:
example: /library/metadata/66485,66098,57249,11449,5858,14944
type: string
key:
example: /library/sections/1/all?sort=lastViewedAt:desc&unwatched=0&viewOffset=0
type: string
more:
example: true
type: boolean
promoted:
example: true
type: boolean
random:
example: true
type: boolean
size:
example: 6
format: int32
type: integer
style:
example: shelf
type: string
title:
example: Recently Played Movies
type: string
type:
example: movie
type: string
type: object
type: array
allowSync:
example: true
type: boolean
identifier:
example: com.plexapp.plugins.library
type: string
librarySectionID:
example: 1
format: int32
type: integer
librarySectionTitle:
example: Movies
type: string
librarySectionUUID:
example: 322a231a-b7f7-49f5-920f-14c61199cd30
type: string
size:
example: 7
format: int32
type: integer
type: object
type: object
description: The hubs specific to the library
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get library specific hubs
tags:
- Hubs
x-codeSamples:
- label: getLibraryHubs
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->hubs->getLibraryHubs(6728.76, 9010.22, Operations\\QueryParamOnlyTransient::Zero);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getLibraryHubs
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.hubs.get_library_hubs(section_id=6728.76, count=9010.22, only_transient=::OpenApiSDK::Operations::QueryParamOnlyTransient::ZERO)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getLibraryHubs
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sectionID float64 = 6728.76
var count *float64 = plexgo.Float64(9010.22)
var onlyTransient *operations.QueryParamOnlyTransient = operations.QueryParamOnlyTransientZero.ToPointer()
ctx := context.Background()
res, err := s.Hubs.GetLibraryHubs(ctx, sectionID, count, onlyTransient)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getLibraryHubs
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetLibraryHubsResponse res = sdk.hubs().getLibraryHubs()
.sectionId(6728.76d)
.count(9010.22d)
.onlyTransient(QueryParamOnlyTransient.ZERO)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetLibraryHubsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getLibraryHubs
lang: typescript
source: |-
import { PlexAPI, QueryParamOnlyTransient } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.hubs.getLibraryHubs(6728.76, 9010.22, QueryParamOnlyTransient.Zero);
// Handle the result
console.log(result)
}
run();
/identity:
get:
description: Get Server Identity
operationId: getServerIdentity
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
claimed:
type: boolean
machineIdentifier:
example: 96f2fe7a78c9dc1f16a16bedbe90f98149be16b4
type: string
size:
example: 0
type: number
version:
example: 1.31.3.6868-28fc46b27
type: string
type: object
type: object
description: The Server Identity information
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Server Identity
tags:
- Server
x-codeSamples:
- label: getServerIdentity
lang: php
source: |-
<?php
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->server->getServerIdentity();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getServerIdentity
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.server.get_server_identity()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getServerIdentity
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Server.GetServerIdentity(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getServerIdentity
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetServerIdentityResponse res = sdk.server().getServerIdentity()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetServerIdentityResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getServerIdentity
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getServerIdentity();
// Handle the result
console.log(result)
}
run();
/library/all/top:
get:
description: |
This endpoint will return the top watched content from libraries of a certain type
operationId: getTopWatchedContent
parameters:
- description: the library type (1 - movies, 2 - shows, 3 - music)
examples:
movies:
value: 1
music:
value: 3
shows:
value: 2
in: query
name: type
required: true
schema:
type: integer
- description: |
Adds the Guids object to the response
example: 1
in: query
name: includeGuids
required: false
schema:
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Country:
items:
properties:
filter:
example: country=116
type: string
id:
example: 116
format: int32
type: integer
tag:
example: United States of America
type: string
type: object
type: array
Genre:
items:
properties:
filter:
example: genre=184
type: string
id:
example: 184
format: int32
type: integer
tag:
example: Thriller
type: string
type: object
type: array
Guid:
items:
properties:
id:
example: tvdb://2337
type: string
type: object
type: array
x-speakeasy-name-override: guids
Role:
items:
properties:
filter:
example: actor=220
type: string
id:
example: 220
format: int32
type: integer
role:
example: Bar Guy (uncredited)
type: string
tag:
example: Dennis Keiffer
type: string
tagKey:
example: 5d77683554f42c001f8c4708
type: string
thumb:
example: https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg
type: string
type: object
type: array
User:
items:
properties:
id:
example: 220
format: int32
type: integer
type: object
type: array
addedAt:
example: 1705637164
format: int32
type: integer
art:
example: /library/metadata/17/art/1705637165
type: string
audienceRating:
example: 9.1
type: number
audienceRatingImage:
example: rottentomatoes://image.rating.upright
type: string
childCount:
example: 13
type: integer
contentRating:
example: PG-13
type: string
duration:
example: 141417
format: int32
type: integer
globalViewCount:
example: 80
type: integer
guid:
example: plex://movie/5d77683f6f4521001ea9dc53
type: string
index:
example: 1
type: integer
key:
example: /library/metadata/17
type: string
leafCount:
example: 222
type: integer
librarySectionID:
example: 1
format: int32
type: integer
librarySectionKey:
example: /library/sections/1
type: string
librarySectionTitle:
example: Movies
type: string
originallyAvailableAt:
example: 2005-09-29T00:00:00Z
format: date
type: string
ratingKey:
example: "17"
type: string
slug:
example: waterloo-road
type: string
studio:
example: Universal Pictures
type: string
summary:
example: Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.
type: string
tagline:
example: They aim to misbehave.
type: string
thumb:
example: /library/metadata/17/thumb/1705637165
type: string
title:
example: Serenity
type: string
type:
example: movie
type: string
updatedAt:
example: 1705637165
format: int32
type: integer
viewedLeafCount:
example: 100
type: integer
year:
example: 2005
format: int32
type: integer
type: object
type: array
allowSync:
example: true
type: boolean
identifier:
example: com.plexapp.plugins.library
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1698860922
format: int32
type: integer
size:
example: 1
format: int32
type: integer
type: object
type: object
description: The metadata of the library item.
summary: Get Top Watched Content
tags:
- Library
x-codeSamples:
- label: getTopWatchedContent
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->getTopWatchedContent(505531, 1);\n\n if ($response->object !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getTopWatchedContent
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_top_watched_content(type=505531, include_guids=1)\n\nif ! res.object.nil?\n # handle response\nend"
- label: getTopWatchedContent
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var type_ int64 = 505531
var includeGuids *int64 = plexgo.Int64(1)
ctx := context.Background()
res, err := s.Library.GetTopWatchedContent(ctx, type_, includeGuids)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getTopWatchedContent
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetTopWatchedContentResponse res = sdk.library().getTopWatchedContent()
.type(505531L)
.includeGuids(1L)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getTopWatchedContent
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getTopWatchedContent(505531, 1);
// Handle the result
console.log(result)
}
run();
/library/hashes:
get:
description: This resource returns hash values for local files
operationId: getFileHash
parameters:
- description: This is the path to the local file, must be prefixed by `file://`
in: query
name: url
required: true
schema:
example: file://C:\Image.png&type=13
type: string
- description: Item type
in: query
name: type
required: false
schema:
type: number
responses:
"200":
description: The hash of the file
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Hash Value
tags:
- Library
x-codeSamples:
- label: getFileHash
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->getFileHash('file://C:\\Image.png&type=13', 4462.17);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getFileHash
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_file_hash(url=\"file://C:\\Image.png&type=13\", type=4462.17)\n\nif res.status_code == 200\n # handle response\nend"
- label: getFileHash
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var url_ string = "file://C:\Image.png&type=13"
var type_ *float64 = plexgo.Float64(4462.17)
ctx := context.Background()
res, err := s.Library.GetFileHash(ctx, url_, type_)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: getFileHash
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetFileHashResponse res = sdk.library().getFileHash()
.url("file://C:\Image.png&type=13")
.type(4462.17d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.GetFileHashResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getFileHash
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getFileHash("file://C:\Image.png&type=13", 4462.17);
// Handle the result
console.log(result)
}
run();
/library/metadata/{ratingKey}:
get:
description: |
This endpoint will return the metadata of a library item specified with the ratingKey.
operationId: getMetadata
parameters:
- description: the id of the library item to return the children of.
examples:
rating-key:
value: 17
in: path
name: ratingKey
required: true
schema:
type: number
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Country:
items:
properties:
filter:
example: country=116
type: string
id:
example: 116
format: int32
type: integer
tag:
example: United States of America
type: string
type: object
type: array
Director:
items:
properties:
filter:
example: director=130
type: string
id:
example: 130
format: int32
type: integer
tag:
example: Joss Whedon
type: string
tagKey:
example: 5d776828880197001ec90e8f
type: string
thumb:
example: https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg
type: string
type: object
type: array
Genre:
items:
properties:
filter:
example: genre=184
type: string
id:
example: 184
format: int32
type: integer
tag:
example: Thriller
type: string
type: object
type: array
Guid:
items:
properties:
id:
example: tvdb://2337
type: string
type: object
type: array
x-speakeasy-name-override: guids
Media:
items:
properties:
Part:
items:
properties:
Stream:
items:
properties:
bitDepth:
example: 8
format: int32
type: integer
bitrate:
example: 128
format: int32
type: integer
channels:
example: 2
format: int32
type: integer
chromaLocation:
example: left
type: string
chromaSubsampling:
example: 14520
type: string
codec:
example: aac
type: string
codedHeight:
example: 816
format: int32
type: integer
codedWidth:
example: 1920
format: int32
type: integer
colorPrimaries:
example: bt709
type: string
colorRange:
example: tv
type: string
colorSpace:
example: bt709
type: string
colorTrc:
example: bt709
type: string
default:
example: true
type: boolean
displayTitle:
example: English (AAC Stereo)
type: string
extendedDisplayTitle:
example: English (AAC Stereo)
type: string
frameRate:
example: 24
format: int32
type: integer
hasScalingMatrix:
example: false
type: boolean
height:
example: 814
format: int32
type: integer
id:
example: 29
format: int32
type: integer
index:
example: 0
format: int32
type: integer
language:
example: English
type: string
languageCode:
example: eng
type: string
languageTag:
example: en
type: string
level:
example: 40
format: int32
type: integer
profile:
example: lc
type: string
refFrames:
example: 4
format: int32
type: integer
samplingRate:
example: 44100
format: int32
type: integer
scanType:
example: progressive
type: string
selected:
example: true
type: boolean
streamIdentifier:
example: "1"
type: string
streamType:
example: 2
format: int32
type: integer
width:
example: 1920
format: int32
type: integer
type: object
type: array
audioProfile:
example: lc
type: string
container:
example: mp4
type: string
duration:
example: 141417
format: int32
type: integer
file:
example: /movies/Serenity (2005)/Serenity (2005).mp4
type: string
has64bitOffsets:
example: false
type: boolean
id:
example: 15
format: int32
type: integer
key:
example: /library/parts/15/1705637151/file.mp4
type: string
optimizedForStreaming:
example: false
type: boolean
size:
example: 40271948
format: int32
type: integer
videoProfile:
example: high
type: string
type: object
type: array
aspectRatio:
example: 2.35
type: number
audioChannels:
example: 2
format: int32
type: integer
audioCodec:
example: aac
type: string
audioProfile:
example: lc
type: string
bitrate:
example: 2278
format: int32
type: integer
container:
example: mp4
type: string
duration:
example: 141417
format: int32
type: integer
has64bitOffsets:
example: false
type: boolean
height:
example: 814
format: int32
type: integer
id:
example: 15
format: int32
type: integer
optimizedForStreaming:
example: 0
format: int32
type: integer
videoCodec:
example: h264
type: string
videoFrameRate:
example: 24p
type: string
videoProfile:
example: high
type: string
videoResolution:
example: "1080"
type: string
width:
example: 1920
format: int32
type: integer
type: object
type: array
Producer:
items:
properties:
filter:
example: producer=221
type: string
id:
example: 221
format: int32
type: integer
tag:
example: Barry Mendel
type: string
tagKey:
example: 5d776826961905001eb90e2b
type: string
thumb:
example: https://metadata-static.plex.tv/8/people/87877371326a964634d18556d94547e1.jpg
type: string
type: object
type: array
Rating:
items:
properties:
image:
example: themoviedb://image.rating
type: string
type:
example: audience
type: string
value:
example: 7.4
type: number
type: object
type: array
x-speakeasy-name-override: ratings
Role:
items:
properties:
filter:
example: actor=220
type: string
id:
example: 220
format: int32
type: integer
role:
example: Bar Guy (uncredited)
type: string
tag:
example: Dennis Keiffer
type: string
tagKey:
example: 5d77683554f42c001f8c4708
type: string
thumb:
example: https://metadata-static.plex.tv/6/people/648e9a7ea1d537bccfcd7615134b78ce.jpg
type: string
type: object
type: array
Writer:
items:
properties:
filter:
example: writer=132
type: string
id:
example: 132
format: int32
type: integer
tag:
example: Joss Whedon
type: string
tagKey:
example: 5d776828880197001ec90e8f
type: string
thumb:
example: https://metadata-static.plex.tv/people/5d776828880197001ec90e8f.jpg
type: string
type: object
type: array
addedAt:
example: 1705637164
format: int32
type: integer
art:
example: /library/metadata/17/art/1705637165
type: string
audienceRating:
example: 9.1
type: number
audienceRatingImage:
example: rottentomatoes://image.rating.upright
type: string
contentRating:
example: PG-13
type: string
duration:
example: 141417
format: int32
type: integer
guid:
example: plex://movie/5d77683f6f4521001ea9dc53
type: string
hasPremiumPrimaryExtra:
example: "1"
type: string
key:
example: /library/metadata/17
type: string
librarySectionID:
example: 1
format: int32
type: integer
librarySectionKey:
example: /library/sections/1
type: string
librarySectionTitle:
example: Movies
type: string
originallyAvailableAt:
example: 2005-09-29T00:00:00Z
format: date
type: string
rating:
example: 8.2
type: number
ratingImage:
example: rottentomatoes://image.rating.ripe
type: string
ratingKey:
example: "17"
type: string
studio:
example: Universal Pictures
type: string
summary:
example: Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.
type: string
tagline:
example: They aim to misbehave.
type: string
thumb:
example: /library/metadata/17/thumb/1705637165
type: string
title:
example: Serenity
type: string
type:
example: movie
type: string
updatedAt:
example: 1705637165
format: int32
type: integer
year:
example: 2005
format: int32
type: integer
type: object
type: array
allowSync:
example: true
type: boolean
identifier:
example: com.plexapp.plugins.library
type: string
librarySectionID:
example: 1
format: int32
type: integer
librarySectionTitle:
example: Movies
type: string
librarySectionUUID:
example: cfc899d7-3000-46f6-8489-b9592714ada5
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1698860922
format: int32
type: integer
size:
example: 1
format: int32
type: integer
type: object
type: object
description: The metadata of the library item.
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Items Metadata
tags:
- Library
x-codeSamples:
- label: getMetadata
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->getMetadata(8382.31);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getMetadata
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_metadata(rating_key=8382.31)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getMetadata
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var ratingKey float64 = 8382.31
ctx := context.Background()
res, err := s.Library.GetMetadata(ctx, ratingKey)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getMetadata
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetMetadataResponse res = sdk.library().getMetadata()
.ratingKey(8382.31d)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetMetadataResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getMetadata
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getMetadata(8382.31);
// Handle the result
console.log(result)
}
run();
/library/metadata/{ratingKey}/children:
get:
description: |
This endpoint will return the children of of a library item specified with the ratingKey.
operationId: getMetadataChildren
parameters:
- description: the id of the library item to return the children of.
in: path
name: ratingKey
required: true
schema:
type: number
- description: |
Adds additional elements to the response. Supported types are (Stream)
examples:
include-stream:
value: Stream
include-stream-otheritem:
value: Stream,OtherItem
include-stream-otheritem-anotheritem:
value: Stream,OtherItem,AnotherItem
in: query
name: includeElements
required: false
schema:
type: string
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Directory:
example:
- key: /library/metadata/30072/allLeaves
leafCount: 16
thumb: /library/metadata/30072/thumb/1705739923
title: All episodes
viewedLeafCount: 16
items:
properties:
key:
example: /library/metadata/30072/allLeaves
type: string
leafCount:
example: 16
format: int32
type: integer
thumb:
example: /library/metadata/30072/thumb/1705739923
type: string
title:
example: All episodes
type: string
viewedLeafCount:
example: 16
format: int32
type: integer
type: object
type: array
Metadata:
items:
properties:
addedAt:
example: 1702602021
format: int32
type: integer
art:
example: /library/metadata/30072/art/1705739923
type: string
guid:
example: plex://season/652aea6549508477c34c6000
type: string
index:
example: 2
format: int32
type: integer
key:
example: /library/metadata/66488/children
type: string
lastRatedAt:
example: 1703881224
format: int32
type: integer
lastViewedAt:
example: 1705646565
format: int32
type: integer
leafCount:
example: 8
format: int32
type: integer
parentGuid:
example: plex://show/5d9c09190aaccd001f8f42f0
type: string
parentIndex:
example: 1
format: int32
type: integer
parentKey:
example: /library/metadata/30072
type: string
parentRatingKey:
example: "30072"
type: string
parentStudio:
example: Amazon Studios
type: string
parentTheme:
example: /library/metadata/30072/theme/1705739923
type: string
parentThumb:
example: /library/metadata/30072/thumb/1705739923
type: string
parentTitle:
example: Reacher
type: string
parentYear:
example: 2022
format: int32
type: integer
ratingKey:
example: "66488"
type: string
skipCount:
example: 1
format: int32
type: integer
summary:
example: Based on"Bad Luck and Trouble," when members of Reacher's old military unit start turning up dead, Reacher has just one thing on his mind—revenge.
type: string
thumb:
example: /library/metadata/66488/thumb/1703065033
type: string
title:
example: Season 2
type: string
type:
example: season
type: string
updatedAt:
example: 1703065033
format: int32
type: integer
userRating:
example: 9
format: int32
type: integer
viewCount:
example: 11
format: int32
type: integer
viewedLeafCount:
example: 8
format: int32
type: integer
type: object
type: array
allowSync:
example: true
type: boolean
art:
example: /library/metadata/30072/art/1705739923
type: string
identifier:
example: com.plexapp.plugins.library
type: string
key:
example: "30072"
type: string
librarySectionID:
example: 2
format: int32
type: integer
librarySectionTitle:
example: TV Shows
type: string
librarySectionUUID:
example: 4bb2521c-8ba9-459b-aaee-8ab8bc35eabd
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1701731894
format: int32
type: integer
nocache:
example: true
type: boolean
parentIndex:
example: 1
format: int32
type: integer
parentTitle:
example: Reacher
type: string
parentYear:
example: 2022
format: int32
type: integer
size:
example: 3
format: int32
type: integer
summary:
example: When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.
type: string
theme:
example: /library/metadata/30072/theme/1705739923
type: string
thumb:
example: /library/metadata/30072/thumb/1705739923
type: string
title1:
example: TV Shows
type: string
title2:
example: Reacher
type: string
viewGroup:
example: season
type: string
viewMode:
example: 65593
format: int32
type: integer
type: object
type: object
description: The children of the library item.
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Items Children
tags:
- Library
x-codeSamples:
- label: getMetadataChildren
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->getMetadataChildren(1539.14, '<value>');\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getMetadataChildren
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_metadata_children(rating_key=1539.14, include_elements=\"<value>\")\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getMetadataChildren
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var ratingKey float64 = 1539.14
var includeElements *string = plexgo.String("<value>")
ctx := context.Background()
res, err := s.Library.GetMetadataChildren(ctx, ratingKey, includeElements)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getMetadataChildren
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetMetadataChildrenResponse res = sdk.library().getMetadataChildren()
.ratingKey(1539.14d)
.includeElements("<value>")
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetMetadataChildrenResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getMetadataChildren
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getMetadataChildren(1539.14, "<value>");
// Handle the result
console.log(result)
}
run();
/library/onDeck:
get:
description: |
This endpoint will return the on deck content.
operationId: getOnDeck
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Guid:
items:
properties:
id:
example: imdb://tt13303712
type: string
type: object
type: array
x-speakeasy-name-override: guids
Media:
items:
properties:
Part:
items:
properties:
Stream:
items:
properties:
bitDepth:
example: 8
type: number
bitrate:
example: 918
type: number
chromaLocation:
example: left
type: string
chromaSubsampling:
example: "4:2:0"
type: string
codec:
example: hevc
type: string
codedHeight:
example: 1080
type: number
codedWidth:
example: 1920
type: number
colorRange:
example: tv
type: string
default:
type: boolean
displayTitle:
example: 1080p (HEVC Main)
type: string
extendedDisplayTitle:
example: 1080p (HEVC Main)
type: string
frameRate:
example: 25
type: number
height:
example: 1080
type: number
id:
example: 211234
type: number
index:
example: 0
type: number
language:
example: English
type: string
languageCode:
example: eng
type: string
languageTag:
example: en
type: string
level:
example: 120
type: number
profile:
example: main
type: string
refFrames:
example: 1
type: number
streamType:
example: 1
type: number
width:
example: 1920
type: number
type: object
type: array
audioProfile:
example: lc
type: string
container:
example: mkv
type: string
duration:
example: 420080
type: number
file:
example: /tvshows/Bluey (2018)/Bluey (2018) - S02E33 - Circus.mkv
type: string
id:
example: 80994
type: number
key:
example: /library/parts/80994/1655007810/file.mkv
type: string
size:
example: 55148931
type: number
videoProfile:
example: main
type: string
type: object
type: array
aspectRatio:
example: 1.78
type: number
audioChannels:
example: 2
type: number
audioCodec:
example: aac
type: string
audioProfile:
example: lc
type: string
bitrate:
example: 1046
type: number
container:
example: mkv
type: string
duration:
example: 420080
type: number
height:
example: 1080
type: number
id:
example: 80994
type: number
videoCodec:
example: hevc
type: string
videoFrameRate:
example: PAL
type: string
videoProfile:
example: main
type: string
videoResolution:
example: "1080"
type: string
width:
example: 1920
type: number
type: object
type: array
addedAt:
example: 1654258196
type: number
allowSync:
type: boolean
art:
example: /library/metadata/49556/art/1680939546
type: string
contentRating:
example: TV-Y
type: string
duration:
example: 420080
type: number
grandparentArt:
example: /library/metadata/49556/art/1680939546
type: string
grandparentGuid:
example: plex://show/5d9c090e705e7a001e6e94d8
type: string
grandparentKey:
example: /library/metadata/49556
type: string
grandparentRatingKey:
example: 49556
type: number
grandparentTheme:
example: /library/metadata/49556/theme/1680939546
type: string
grandparentThumb:
example: /library/metadata/49556/thumb/1680939546
type: string
grandparentTitle:
example: Bluey (2018)
type: string
guid:
example: plex://episode/5ea7d7402e7ab10042e74d4f
type: string
index:
example: 33
type: number
key:
example: /library/metadata/49564
type: string
lastViewedAt:
example: 1681908352
type: number
librarySectionID:
example: 2
type: number
librarySectionKey:
example: /library/sections/2
type: string
librarySectionTitle:
example: TV Shows
type: string
librarySectionUUID:
example: 4bb2521c-8ba9-459b-aaee-8ab8bc35eabd
type: string
originallyAvailableAt:
example: 2020-10-31T00:00:00Z
format: date-time
type: string
parentGuid:
example: plex://season/602e754d67f4c8002ce54b3d
type: string
parentIndex:
example: 2
type: number
parentKey:
example: /library/metadata/49557
type: string
parentRatingKey:
example: 49557
type: number
parentThumb:
example: /library/metadata/49557/thumb/1654258204
type: string
parentTitle:
example: Season 2
type: string
ratingKey:
example: 49564
type: number
summary:
example: Bluey is the ringmaster in a game of circus with her friends but Hercules wants to play his motorcycle game instead. Luckily Bluey has a solution to keep everyone happy.
type: string
thumb:
example: /library/metadata/49564/thumb/1654258204
type: string
title:
example: Circus
type: string
type:
example: episode
type: string
updatedAt:
example: 1654258204
type: number
year:
example: 2018
type: number
type: object
type: array
allowSync:
type: boolean
identifier:
example: com.plexapp.plugins.library
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1680021154
type: number
mixedParents:
type: boolean
size:
example: 16
type: number
type: object
type: object
description: The on Deck content
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get On Deck
tags:
- Library
x-codeSamples:
- label: getOnDeck
lang: php
source: |-
<?php
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->library->getOnDeck();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getOnDeck
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_on_deck()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getOnDeck
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Library.GetOnDeck(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getOnDeck
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetOnDeckResponse res = sdk.library().getOnDeck()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetOnDeckResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getOnDeck
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getOnDeck();
// Handle the result
console.log(result)
}
run();
/library/recentlyAdded:
get:
description: |
This endpoint will return the recently added content.
operationId: getRecentlyAdded
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Country:
items:
properties:
tag:
example: United States of America
type: string
type: object
type: array
Director:
items:
properties:
tag:
example: Peyton Reed
type: string
type: object
type: array
Genre:
items:
properties:
tag:
example: Comedy
type: string
type: object
type: array
Media:
items:
properties:
Part:
items:
properties:
container:
example: mp4
type: string
duration:
example: 7474422
type: number
file:
example: /movies/Ant-Man and the Wasp Quantumania (2023)/Ant-Man.and.the.Wasp.Quantumania.2023.1080p.mp4
type: string
has64bitOffsets:
type: boolean
hasThumbnail:
example: 1
type: number
id:
example: 120353
type: number
key:
example: /library/parts/120353/1681803203/file.mp4
type: string
optimizedForStreaming:
type: boolean
size:
example: 3395307162
type: number
videoProfile:
example: high
type: string
type: object
type: array
aspectRatio:
example: 2.35
type: number
audioChannels:
example: 6
type: number
audioCodec:
example: ac3
type: string
bitrate:
example: 3623
type: number
container:
example: mp4
type: string
duration:
example: 7474422
type: number
has64bitOffsets:
type: boolean
height:
example: 804
type: number
id:
example: 120345
type: number
optimizedForStreaming:
example: 0
type: number
videoCodec:
example: h264
type: string
videoFrameRate:
example: 24p
type: string
videoProfile:
example: high
type: string
videoResolution:
example: 1080
type: number
width:
example: 1920
type: number
type: object
type: array
Role:
items:
properties:
tag:
example: Paul Rudd
type: string
type: object
type: array
Writer:
items:
properties:
tag:
example: Jeff Loveness
type: string
type: object
type: array
addedAt:
example: 1681803215
type: number
allowSync:
type: boolean
art:
example: /library/metadata/59398/art/1681888010
type: string
audienceRating:
example: 8.3
type: number
audienceRatingImage:
example: rottentomatoes://image.rating.upright
type: string
chapterSource:
example: media
type: string
contentRating:
example: PG-13
type: string
duration:
example: 7474422
type: number
guid:
example: plex://movie/5e161a83bea6ac004126e148
type: string
key:
example: /library/metadata/59398
type: string
librarySectionID:
example: 1
type: number
librarySectionTitle:
example: Movies
type: string
librarySectionUUID:
example: 322a231a-b7f7-49f5-920f-14c61199cd30
type: string
originallyAvailableAt:
example: 2023-02-15T00:00:00Z
format: date-time
type: string
primaryExtraKey:
example: /library/metadata/59399
type: string
rating:
example: 4.7
type: number
ratingImage:
example: rottentomatoes://image.rating.rotten
type: string
ratingKey:
example: 59398
type: number
studio:
example: Marvel Studios
type: string
summary:
example: Scott Lang and Hope Van Dyne along with Hank Pym and Janet Van Dyne explore the Quantum Realm where they interact with strange creatures and embark on an adventure that goes beyond the limits of what they thought was possible.
type: string
tagline:
example: Witness the beginning of a new dynasty.
type: string
thumb:
example: /library/metadata/59398/thumb/1681888010
type: string
title:
example: 'Ant-Man and the Wasp: Quantumania'
type: string
type:
example: movie
type: string
updatedAt:
example: 1681888010
type: number
year:
example: 2023
type: number
type: object
type: array
allowSync:
type: boolean
identifier:
example: com.plexapp.plugins.library
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1680021154
type: number
mixedParents:
type: boolean
size:
example: 50
type: number
type: object
type: object
description: The recently added content
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Recently Added
tags:
- Library
x-codeSamples:
- label: getRecentlyAdded
lang: php
source: |-
<?php
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->library->getRecentlyAdded();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getRecentlyAdded
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_recently_added()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getRecentlyAdded
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Library.GetRecentlyAdded(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getRecentlyAdded
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetRecentlyAddedResponse res = sdk.library().getRecentlyAdded()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetRecentlyAddedResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getRecentlyAdded
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getRecentlyAdded();
// Handle the result
console.log(result)
}
run();
/library/sections:
get:
description: "A library section (commonly referred to as just a library) is a collection of media. \nLibraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. \nFor example, a music library has an artist > albums > tracks structure, whereas a movie library is flat.\n\nLibraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. \nThis allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year).\n"
operationId: getLibraries
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Directory:
items:
properties:
Location:
items:
properties:
id:
example: 1
format: int32
type: integer
path:
example: /movies
type: string
type: object
type: array
agent:
example: tv.plex.agents.movie
type: string
allowSync:
example: true
type: boolean
art:
example: /:/resources/movie-fanart.jpg
type: string
composite:
example: /library/sections/1/composite/1705615584
type: string
content:
example: true
type: boolean
contentChangedAt:
example: 3192854
format: int32
type: integer
createdAt:
example: 1654131312
format: int32
type: integer
directory:
example: true
type: boolean
filters:
example: true
type: boolean
hidden:
example: 0
format: int32
type: integer
key:
example: "1"
type: string
language:
example: en-US
type: string
refreshing:
example: false
type: boolean
scannedAt:
example: 1705615584
format: int32
type: integer
scanner:
example: Plex Movie
type: string
thumb:
example: /:/resources/movie.png
type: string
title:
example: Movies
type: string
type:
example: movie
type: string
updatedAt:
example: 1705615634
format: int32
type: integer
uuid:
example: 322a231a-b7f7-49f5-920f-14c61199cd30
type: string
type: object
type: array
allowSync:
example: false
type: boolean
size:
example: 5
format: int32
type: integer
title1:
example: Plex Library
type: string
type: object
type: object
description: The libraries available on the Server
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get All Libraries
tags:
- Library
x-codeSamples:
- label: getLibraries
lang: php
source: |-
<?php
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->library->getLibraries();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getLibraries
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_libraries()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getLibraries
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Library.GetLibraries(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getLibraries
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetLibrariesResponse res = sdk.library().getLibraries()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetLibrariesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getLibraries
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getLibraries();
// Handle the result
console.log(result)
}
run();
/library/sections/{sectionId}:
delete:
description: Delate a library using a specific section
operationId: deleteLibrary
parameters:
- description: the Id of the library to query
in: path
name: sectionId
required: true
schema:
example: 1000
type: number
responses:
"200":
description: The library is deleted
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Delete Library Section
tags:
- Library
x-codeSamples:
- label: deleteLibrary
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->deleteLibrary(1000);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: deleteLibrary
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.delete_library(section_id=1000.0)\n\nif res.status_code == 200\n # handle response\nend"
- label: deleteLibrary
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sectionID float64 = 1000
ctx := context.Background()
res, err := s.Library.DeleteLibrary(ctx, sectionID)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: deleteLibrary
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
DeleteLibraryResponse res = sdk.library().deleteLibrary()
.sectionId(1000d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.DeleteLibraryResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: deleteLibrary
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.deleteLibrary(1000);
// Handle the result
console.log(result)
}
run();
get:
description: "## Library Details Endpoint\n\nThis endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself. \n\nThe details include:\n\n### Directories\nOrganized into three categories:\n\n- **Primary Directories**: \n - Used in some clients for quick access to media subsets (e.g., \"All\", \"On Deck\").\n - Most can be replicated via media queries.\n - Customizable by users.\n\n- **Secondary Directories**:\n - Marked with `secondary=\"1\"`.\n - Used in older clients for structured navigation.\n\n- **Special Directories**:\n - Includes a \"By Folder\" entry for filesystem-based browsing.\n - Contains an obsolete `search=\"1\"` entry for on-the-fly search dialog creation.\n\n### Types\nEach type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:\n\n- **Type Object Attributes**:\n - `key`: Endpoint for the media list of this type.\n - `type`: Metadata type (if standard Plex type).\n - `title`: Title for this content type (e.g., \"Movies\").\n\n- **Filter Objects**:\n - Subset of the media query language.\n - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.\n\n- **Sort Objects**:\n - Description of sort fields.\n - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.\n\n> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.\n"
operationId: getLibrary
parameters:
- description: the Id of the library to query
in: path
name: sectionId
required: true
schema:
example: 1000
type: number
- description: "Whether or not to include details for a section (types, filters, and sorts). \nOnly exists for backwards compatibility, media providers other than the server libraries have it on always.\n"
in: query
name: includeDetails
required: false
schema:
default: 0
enum:
- 0
- 1
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Directory:
items:
properties:
key:
example: search?type=1
type: string
prompt:
example: Search Movies
type: string
search:
example: true
type: boolean
secondary:
example: true
type: boolean
title:
example: Search...
type: string
type: object
type: array
FieldType:
items:
properties:
Operator:
items:
properties:
key:
example: =
type: string
title:
example: is
type: string
type: object
type: array
type:
example: resolution
type: string
type: object
type: array
Type:
items:
properties:
Field:
items:
properties:
key:
example: label
type: string
subType:
example: bitrate
type: string
title:
example: Label
type: string
type:
example: tag
type: string
type: object
type: array
Filter:
items:
properties:
filter:
example: label
type: string
filterType:
example: string
type: string
key:
example: /library/sections/1/label
type: string
title:
example: Labels
type: string
type:
example: filter
type: string
type: object
type: array
Sort:
items:
properties:
default:
example: asc
type: string
defaultDirection:
example: desc
type: string
descKey:
example: random:desc
type: string
firstCharacterKey:
example: /library/sections/1/firstCharacter
type: string
key:
example: random
type: string
title:
example: Randomly
type: string
type: object
type: array
active:
example: false
type: boolean
key:
example: /library/sections/1/all?type=1
type: string
title:
example: Movies
type: string
type:
example: movie
type: string
type: object
type: array
allowSync:
example: false
type: boolean
art:
example: /:/resources/movie-fanart.jpg
type: string
content:
example: secondary
type: string
identifier:
example: com.plexapp.plugins.library
type: string
librarySectionID:
example: 1
format: int32
type: integer
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1701731894
format: int32
type: integer
size:
example: 29
format: int32
type: integer
thumb:
example: /:/resources/movie.png
type: string
title1:
example: Movies
type: string
viewGroup:
example: secondary
type: string
viewMode:
example: 65592
format: int32
type: integer
type: object
type: object
description: The details of the library
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Library Details
tags:
- Library
x-codeSamples:
- label: getLibrary
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->getLibrary(1000, Operations\\IncludeDetails::Zero);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getLibrary
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_library(section_id=1000.0, include_details=::OpenApiSDK::Operations::IncludeDetails::ZERO)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getLibrary
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sectionID float64 = 1000
var includeDetails *operations.IncludeDetails = operations.IncludeDetailsZero.ToPointer()
ctx := context.Background()
res, err := s.Library.GetLibrary(ctx, sectionID, includeDetails)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getLibrary
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetLibraryResponse res = sdk.library().getLibrary()
.sectionId(1000d)
.includeDetails(IncludeDetails.ZERO)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetLibraryResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getLibrary
lang: typescript
source: |-
import { IncludeDetails, PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getLibrary(1000, IncludeDetails.Zero);
// Handle the result
console.log(result)
}
run();
/library/sections/{sectionId}/{tag}:
get:
description: |
Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values:
- `all`: All items in the section.
- `unwatched`: Items that have not been played.
- `newest`: Items that are recently released.
- `recentlyAdded`: Items that are recently added to the library.
- `recentlyViewed`: Items that were recently viewed.
- `onDeck`: Items to continue watching.
- `collection`: Items categorized by collection.
- `edition`: Items categorized by edition.
- `genre`: Items categorized by genre.
- `year`: Items categorized by year of release.
- `decade`: Items categorized by decade.
- `director`: Items categorized by director.
- `actor`: Items categorized by starring actor.
- `country`: Items categorized by country of origin.
- `contentRating`: Items categorized by content rating.
- `rating`: Items categorized by rating.
- `resolution`: Items categorized by resolution.
- `firstCharacter`: Items categorized by the first letter.
- `folder`: Items categorized by folder.
operationId: getLibraryItems
parameters:
- description: the Id of the library to query
in: path
name: sectionId
required: true
schema:
examples:
librarySectionID:
value: 1
providerSectionID:
value: watchlist
type:
- integer
- string
x-speakeasy-type-override: any
- description: A key representing a specific tag within the section.
in: path
name: tag
required: true
schema:
enum:
- all
- unwatched
- newest
- recentlyAdded
- recentlyViewed
- onDeck
- collection
- edition
- genre
- year
- decade
- director
- actor
- country
- contentRating
- rating
- resolution
- firstCharacter
- folder
type: string
- description: |
Adds the Guids object to the response
example: 1
in: query
name: includeGuids
required: false
schema:
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Country:
items:
properties:
tag:
example: United States of America
type: string
type: object
type: array
Director:
items:
properties:
tag:
example: James Cameron
type: string
type: object
type: array
Genre:
items:
properties:
tag:
example: Adventure
type: string
type: object
type: array
Media:
items:
properties:
Part:
items:
properties:
container:
example: mkv
type: string
duration:
example: 11558112
format: int32
type: integer
file:
example: /movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv
type: string
id:
example: 119542
format: int32
type: integer
key:
example: /library/parts/119542/1680457526/file.mkv
type: string
size:
example: 36158371307
format: int64
type: integer
videoProfile:
example: main 10
type: string
type: object
type: array
aspectRatio:
example: 1.85
type: number
audioChannels:
example: 6
format: int32
type: integer
audioCodec:
example: eac3
type: string
bitrate:
example: 25025
format: int32
type: integer
container:
example: mkv
type: string
duration:
example: 11558112
format: int32
type: integer
height:
example: 2072
format: int32
type: integer
id:
example: 119534
format: int32
type: integer
videoCodec:
example: hevc
type: string
videoFrameRate:
example: 24p
type: string
videoProfile:
example: main 10
type: string
videoResolution:
example: 4k
type: string
width:
example: 3840
format: int32
type: integer
type: object
type: array
Role:
items:
properties:
tag:
example: Sigourney Weaver
type: string
type: object
type: array
Writer:
items:
properties:
tag:
example: James Cameron
type: string
type: object
type: array
addedAt:
example: 1680457607
format: int32
type: integer
art:
example: /library/metadata/58683/art/1703239236
type: string
audienceRating:
example: 9.2
type: number
audienceRatingImage:
example: rottentomatoes://image.rating.upright
type: string
chapterSource:
example: media
type: string
childCount:
example: 1
format: int32
type: integer
contentRating:
example: PG-13
type: string
duration:
example: 11558112
format: int32
type: integer
grandparentArt:
example: /library/metadata/66/art/1705716261
type: string
grandparentGuid:
example: plex://show/5d9c081b170e24001f2a7be4
type: string
grandparentKey:
example: /library/metadata/66
type: string
grandparentRatingKey:
example: "66"
type: string
grandparentTheme:
example: /library/metadata/66/theme/1705716261
type: string
grandparentThumb:
example: /library/metadata/66/thumb/1705716261
type: string
grandparentTitle:
example: Caprica
type: string
guid:
example: plex://movie/5d7768ba96b655001fdc0408
type: string
hasPremiumExtras:
example: "1"
type: string
hasPremiumPrimaryExtra:
example: "1"
type: string
index:
example: 1
format: int32
type: integer
key:
example: /library/metadata/58683
type: string
lastViewedAt:
example: 1682752242
format: int32
type: integer
leafCount:
example: 14
format: int32
type: integer
originalTitle:
example: 映画 ブラッククローバー 魔法帝の剣
type: string
originallyAvailableAt:
example: 2022-12-14T00:00:00Z
format: date
type: string
parentGuid:
example: plex://show/5d9c081b170e24001f2a7be4
type: string
parentIndex:
example: 1
format: int32
type: integer
parentKey:
example: /library/metadata/66
type: string
parentRatingKey:
example: "66"
type: string
parentStudio:
example: UCP
type: string
parentTheme:
example: /library/metadata/66/theme/1705716261
type: string
parentThumb:
example: /library/metadata/66/thumb/1705716261
type: string
parentTitle:
example: Caprica
type: string
parentYear:
example: 2010
format: int32
type: integer
primaryExtraKey:
example: /library/metadata/58684
type: string
rating:
example: 7.6
type: number
ratingImage:
example: rottentomatoes://image.rating.ripe
type: string
ratingKey:
example: "58683"
type: string
skipCount:
example: 1
format: int32
type: integer
studio:
example: 20th Century Studios
type: string
summary:
example: Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.
type: string
tagline:
example: Return to Pandora.
type: string
theme:
example: /library/metadata/1/theme/1705636920
type: string
thumb:
example: /library/metadata/58683/thumb/1703239236
type: string
title:
example: 'Avatar: The Way of Water'
type: string
titleSort:
example: Whale
type: string
type:
example: movie
type: string
updatedAt:
example: 1703239236
format: int32
type: integer
viewCount:
example: 1
format: int32
type: integer
viewOffset:
example: 5222500
format: int32
type: integer
viewedLeafCount:
example: 0
format: int32
type: integer
year:
example: 2022
format: int32
type: integer
type: object
type: array
allowSync:
example: true
type: boolean
art:
example: /:/resources/movie-fanart.jpg
type: string
identifier:
example: com.plexapp.plugins.library
type: string
librarySectionID:
examples:
- 1
- watchlist
type:
- integer
- string
librarySectionTitle:
example: Movies
type: string
librarySectionUUID:
example: 322a231a-b7f7-49f5-920f-14c61199cd30
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1701731894
format: int32
type: integer
mixedParents:
example: true
type: boolean
size:
example: 70
format: int32
type: integer
thumb:
example: /:/resources/movie.png
type: string
title1:
example: Movies
type: string
title2:
example: Recently Released
type: string
viewGroup:
example: movie
type: string
viewMode:
example: 65592
format: int32
type: integer
type: object
type: object
description: The contents of the library by section and tag
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Library Items
tags:
- Library
x-codeSamples:
- label: getLibraryItems
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->getLibraryItems('<value>', Operations\\Tag::Genre, 1);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getLibraryItems
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.get_library_items(section_id=\"<value>\", tag=::OpenApiSDK::Operations::Tag::GENRE, include_guids=1)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getLibraryItems
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sectionID any = "<value>"
var tag operations.Tag = operations.TagGenre
var includeGuids *int64 = plexgo.Int64(1)
ctx := context.Background()
res, err := s.Library.GetLibraryItems(ctx, sectionID, tag, includeGuids)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getLibraryItems
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetLibraryItemsResponse res = sdk.library().getLibraryItems()
.sectionId("<value>")
.tag(Tag.GENRE)
.includeGuids(1L)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetLibraryItemsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getLibraryItems
lang: typescript
source: |-
import { PlexAPI, Tag } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.getLibraryItems("<value>", Tag.Genre, 1);
// Handle the result
console.log(result)
}
run();
/library/sections/{sectionId}/refresh:
get:
description: |
This endpoint Refreshes the library.
operationId: refreshLibrary
parameters:
- description: the Id of the library to refresh
in: path
name: sectionId
required: true
schema:
type: number
responses:
"200":
description: The library is refreshing
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Refresh Library
tags:
- Library
x-codeSamples:
- label: refreshLibrary
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->refreshLibrary(934.16);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: refreshLibrary
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.refresh_library(section_id=934.16)\n\nif res.status_code == 200\n # handle response\nend"
- label: refreshLibrary
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sectionID float64 = 934.16
ctx := context.Background()
res, err := s.Library.RefreshLibrary(ctx, sectionID)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: refreshLibrary
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
RefreshLibraryResponse res = sdk.library().refreshLibrary()
.sectionId(934.16d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.RefreshLibraryResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: refreshLibrary
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.refreshLibrary(934.16);
// Handle the result
console.log(result)
}
run();
/library/sections/{sectionId}/search:
get:
description: "Search for content within a specific section of the library.\n\n### Types\nEach type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:\n\n- **Type Object Attributes**:\n - `type`: Metadata type (if standard Plex type). \n - `title`: Title for this content type (e.g., \"Movies\").\n\n- **Filter Objects**:\n - Subset of the media query language.\n - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.\n\n- **Sort Objects**:\n - Description of sort fields.\n - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.\n\n> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.\n"
operationId: searchLibrary
parameters:
- description: the Id of the library to query
in: path
name: sectionId
required: true
schema:
type: integer
- description: Plex content type to search for
in: query
name: type
required: true
schema:
enum:
- 1
- 2
- 3
- 4
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
addedAt:
example: 1705636916
format: int32
type: integer
art:
example: /library/metadata/1/art/1705636920
type: string
guid:
example: plex://season/602e67e766dfdb002c0a1b5b
type: string
index:
example: 1
format: int32
type: integer
key:
example: /library/metadata/2/children
type: string
parentGuid:
example: plex://show/5d9c086c7d06d9001ffd27aa
type: string
parentIndex:
example: 1
format: int32
type: integer
parentKey:
example: /library/metadata/1
type: string
parentRatingKey:
example: "1"
type: string
parentStudio:
example: Mutant Enemy Productions
type: string
parentTheme:
example: /library/metadata/1/theme/1705636920
type: string
parentThumb:
example: /library/metadata/1/thumb/1705636920
type: string
parentTitle:
example: Firefly
type: string
parentYear:
example: 2002
format: int32
type: integer
ratingKey:
example: "2"
type: string
summary:
example: Captain Malcolm 'Mal' Reynolds is a former galactic war veteran who is the captain of the transport ship "Serenity". Mal and his crew, ensign Zoe Alleyne Washburne; Zoe's husband, pilot Hoban 'Wash' Washburne; muscular mercenary Jayne Cobb; young mechanic Kaylee Frye; former Alliance medical officer Simon Tam; his disturbed teenage sister River (both on the run from the interplanetary government "The Alliance"); the beautiful courtesan Inara Serra; and preacher Shepherd Book do any jobs, legal or illegal, they can find as the Serenity crew travels across the outskirts of outer space.
type: string
thumb:
example: /library/metadata/2/thumb/1705636920
type: string
title:
example: Season 1
type: string
type:
example: season
type: string
updatedAt:
example: 1705636920
format: int32
type: integer
type: object
type: array
allowSync:
example: false
type: boolean
art:
example: /:/resources/show-fanart.jpg
type: string
identifier:
example: com.plexapp.plugins.library
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1698860922
format: int32
type: integer
nocache:
example: true
type: boolean
size:
example: 2
format: int32
type: integer
thumb:
example: /:/resources/show.png
type: string
title1:
example: TV Shows
type: string
title2:
example: Search for ''
type: string
viewGroup:
example: season
type: string
viewMode:
example: 65593
format: int32
type: integer
type: object
type: object
description: The contents of the library by section and type
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Search Library
tags:
- Library
x-codeSamples:
- label: searchLibrary
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->library->searchLibrary(933505, Operations\\Type::Four);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: searchLibrary
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.library.search_library(section_id=933505, type=::OpenApiSDK::Operations::Type::FOUR)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: searchLibrary
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sectionID int64 = 933505
var type_ operations.Type = operations.TypeFour
ctx := context.Background()
res, err := s.Library.SearchLibrary(ctx, sectionID, type_)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: searchLibrary
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
SearchLibraryResponse res = sdk.library().searchLibrary()
.sectionId(933505L)
.type(Type.FOUR)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.SearchLibraryResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: searchLibrary
lang: typescript
source: |-
import { PlexAPI, Type } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.library.searchLibrary(933505, Type.Four);
// Handle the result
console.log(result)
}
run();
/library/sections/watchlist/{filter}:
get:
description: Get User Watchlist
operationId: getWatchlist
parameters:
- description: Filter
in: path
name: filter
required: true
schema:
enum:
- all
- available
- released
type: string
- description: |
In the format "field:dir". Available fields are "watchlistedAt" (Added At),
"titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
"dir" can be "asc" or "desc"
in: query
name: sort
required: false
schema:
type: string
- description: |
The type of library to filter. Can be "movie" or "show", or all if not present.
in: query
name: libtype
required: false
schema:
enum:
- movie
- show
type: string
- description: |
The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
in: query
name: maxresults
required: false
schema:
format: int32
type: integer
- description: |
include collections in the results
in: query
name: includeCollections
required: false
schema:
enum:
- 1
- 0
type: integer
- description: |
include external media in the results
in: query
name: includeExternalMedia
required: false
schema:
enum:
- 1
- 0
type: integer
- description: User Token
in: query
name: X-Plex-Token
required: true
schema:
type: string
- description: |
The index of the first item to return. If not specified, the first item will be returned.
If the number of items exceeds the limit, the response will be paginated.
in: query
name: X-Plex-Container-Start
required: false
schema:
format: int32
type: integer
- description: |
The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
in: query
name: X-Plex-Container-Size
required: false
schema:
format: int32
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
Metadata:
items:
properties:
Image:
items:
properties:
alt:
type: string
type:
type: string
url:
type: string
type: object
type: array
addedAt:
format: int32
type: integer
art:
type: string
audienceRating:
type: number
audienceRatingImage:
type: string
availabilityId:
type: string
banner:
type: string
childCount:
format: int32
type: integer
contentRating:
type: string
duration:
format: int32
type: integer
expiresAt:
format: int32
type: integer
guid:
type: string
imdbRatingCount:
format: int32
type: integer
isContinuingSeries:
type: boolean
key:
type: string
leafCount:
format: int32
type: integer
originalTitle:
type: string
originallyAvailableAt:
format: date
type: string
playableKey:
type: string
publicPagesURL:
type: string
rating:
type: number
ratingImage:
type: string
ratingKey:
type: string
skipChildren:
type: boolean
slug:
type: string
streamingMediaId:
type: string
studio:
type: string
subtype:
type: string
tagline:
type: string
theme:
type: string
thumb:
type: string
title:
type: string
type:
type: string
userState:
type: boolean
year:
format: int32
type: integer
type: object
type: array
identifier:
type: string
librarySectionID:
type: string
librarySectionTitle:
type: string
offset:
format: int32
type: integer
size:
format: int32
type: integer
totalSize:
format: int32
type: integer
type: object
description: Watchlist Data
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get User Watchlist
tags:
- Watchlist
x-codeSamples:
- label: getWatchlist
lang: php
source: |-
<?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('Postman')
->setSecurity($security)->build();
try {
$request = new Operations\GetWatchlistRequest();
$request->filter = Operations\PathParamFilter::Released;
$request->sort = '<value>';
$request->libtype = Operations\Libtype::Movie;
$request->maxresults = 303056;
$request->includeCollections = Operations\IncludeCollections::Zero;
$request->includeExternalMedia = Operations\IncludeExternalMedia::One;
$request->xPlexToken = '<value>';
$request->xPlexContainerStart = 406911;
$request->xPlexContainerSize = 958629;;
$response = $sdk->watchlist->getWatchlist($request);
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getWatchlist
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n\nreq = ::OpenApiSDK::Operations::GetWatchlistRequest.new(\n filter: ::OpenApiSDK::Operations::PathParamFilter::RELEASED,\n x_plex_token: \"<value>\",\n)\n \nres = s.watchlist.get_watchlist(req)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getWatchlist
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
request := operations.GetWatchlistRequest{
Filter: operations.PathParamFilterReleased,
XPlexToken: "<value>",
}
ctx := context.Background()
res, err := s.Watchlist.GetWatchlist(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getWatchlist
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetWatchlistRequest req = GetWatchlistRequest.builder()
.filter(PathParamFilter.RELEASED)
.xPlexToken("<value>")
.build();
GetWatchlistResponse res = sdk.watchlist().getWatchlist()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetWatchlistResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getWatchlist
lang: typescript
source: |-
import { PathParamFilter, PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.watchlist.getWatchlist({
filter: PathParamFilter.Released,
xPlexToken: "<value>",
});
// Handle the result
console.log(result)
}
run();
servers:
- description: The plex metadata provider server
url: https://metadata.provider.plex.tv
/log:
get:
description: |
This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
operationId: logLine
parameters:
- description: "An integer log level to write to the PMS log with. \n0: Error \n1: Warning \n2: Info \n3: Debug \n4: Verbose\n"
in: query
name: level
required: true
schema:
enum:
- 0
- 1
- 2
- 3
- 4
type: integer
- description: The text of the message to write to the log.
in: query
name: message
required: true
schema:
example: Test log message
type: string
- description: a string indicating the source of the message.
in: query
name: source
required: true
schema:
example: Postman
type: string
responses:
"200":
description: Log Message Posted successfully
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Logging a single line message.
tags:
- Log
x-codeSamples:
- label: logLine
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->log->logLine(Operations\\Level::Three, 'Test log message', 'Postman');\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: logLine
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.log.log_line(level=::OpenApiSDK::Operations::Level::THREE, message=\"Test log message\", source=\"Postman\")\n\nif res.status_code == 200\n # handle response\nend"
- label: logLine
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var level operations.Level = operations.LevelThree
var message string = "Test log message"
var source string = "Postman"
ctx := context.Background()
res, err := s.Log.LogLine(ctx, level, message, source)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: logLine
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
LogLineResponse res = sdk.log().logLine()
.level(Level.THREE)
.message("Test log message")
.source("Postman")
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.LogLineResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: logLine
lang: typescript
source: |-
import { Level, PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.log.logLine(Level.Three, "Test log message", "Postman");
// Handle the result
console.log(result)
}
run();
post:
description: "This endpoint allows for the batch addition of log entries to the main Plex Media Server log. \nIt accepts a text/plain request body, where each line represents a distinct log entry. \nEach log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'. \n\nLog entries are separated by a newline character (`\\n`). \nEach entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters. \nThis method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests. \n\nThe 'level' parameter specifies the log entry's severity or importance, with the following integer values:\n- `0`: Error - Critical issues that require immediate attention.\n- `1`: Warning - Important events that are not critical but may indicate potential issues.\n- `2`: Info - General informational messages about system operation.\n- `3`: Debug - Detailed information useful for debugging purposes.\n- `4`: Verbose - Highly detailed diagnostic information for in-depth analysis.\n\nThe 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).\n\nExample of a single log entry format:\n`level=4&message=Sample%20log%20entry&source=applicationName`\n\nEnsure each parameter is properly URL-encoded to avoid interpretation issues.\n"
operationId: logMultiLine
requestBody:
content:
text/plain:
schema:
example: |-
level=4&message=Test%20message%201&source=postman
level=3&message=Test%20message%202&source=postman
level=1&message=Test%20message%203&source=postman
type: string
required: true
responses:
"200":
description: Multi-Line Log Message Posted successfully
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Logging a multi-line message
tags:
- Log
x-codeSamples:
- label: logMultiLine
lang: php
source: |-
<?php
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 {
'level=4&message=Test%20message%201&source=postman
level=3&message=Test%20message%202&source=postman
level=1&message=Test%20message%203&source=postman';
$response = $sdk->log->logMultiLine($request);
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: logMultiLine
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n\nreq = \"level=4&message=Test%20message%201&source=postman\nlevel=3&message=Test%20message%202&source=postman\nlevel=1&message=Test%20message%203&source=postman\"\n \nres = s.log.log_multi_line(req)\n\nif res.status_code == 200\n # handle response\nend"
- label: logMultiLine
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var request string = "level=4&message=Test%20message%201&source=postman
level=3&message=Test%20message%202&source=postman
level=1&message=Test%20message%203&source=postman"
ctx := context.Background()
res, err := s.Log.LogMultiLine(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: logMultiLine
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
String req = "level=4&message=Test%20message%201&source=postman
level=3&message=Test%20message%202&source=postman
level=1&message=Test%20message%203&source=postman";
LogMultiLineResponse res = sdk.log().logMultiLine()
.request(req)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.LogMultiLineResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: logMultiLine
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.log.logMultiLine("level=4&message=Test%20message%201&source=postman
level=3&message=Test%20message%202&source=postman
level=1&message=Test%20message%203&source=postman");
// Handle the result
console.log(result)
}
run();
/log/networked:
get:
description: |
This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
operationId: enablePaperTrail
responses:
"200":
description: Papertrail enabled successfully
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
"403":
description: the user was not signed in
summary: Enabling Papertrail
tags:
- Log
x-codeSamples:
- label: enablePaperTrail
lang: php
source: |-
<?php
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->log->enablePaperTrail();
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: enablePaperTrail
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.log.enable_paper_trail()\n\nif res.status_code == 200\n # handle response\nend"
- label: enablePaperTrail
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Log.EnablePaperTrail(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: enablePaperTrail
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
EnablePaperTrailResponse res = sdk.log().enablePaperTrail()
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.EnablePaperTrailResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: enablePaperTrail
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.log.enablePaperTrail();
// Handle the result
console.log(result)
}
run();
/myplex/account:
get:
description: Returns MyPlex Account Information
operationId: getMyPlexAccount
responses:
"200":
content:
application/json:
schema:
properties:
MyPlex:
properties:
authToken:
example: Z5v-PrNASDFpsaCi3CPK7
type: string
mappingError:
type: string
mappingState:
example: mapped
type: string
privateAddress:
example: 10.10.10.47
type: string
privatePort:
example: 32400
type: number
publicAddress:
example: 140.20.68.140
type: string
publicPort:
example: 32400
type: number
signInState:
example: ok
type: string
subscriptionActive:
type: boolean
subscriptionFeatures:
example: federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks
type: string
subscriptionState:
example: Active
type: string
username:
example: example.email@mail.com
type: string
type: object
type: object
description: MyPlex Account
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get MyPlex Account
tags:
- Server
x-codeSamples:
- label: getMyPlexAccount
lang: php
source: |-
<?php
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->server->getMyPlexAccount();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getMyPlexAccount
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.server.get_my_plex_account()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getMyPlexAccount
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Server.GetMyPlexAccount(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getMyPlexAccount
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetMyPlexAccountResponse res = sdk.server().getMyPlexAccount()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetMyPlexAccountResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getMyPlexAccount
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getMyPlexAccount();
// Handle the result
console.log(result)
}
run();
/photo/:/transcode:
get:
description: |
Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
operationId: getResizedPhoto
parameters:
- description: The width for the resized photo
in: query
name: width
required: true
schema:
example: 110
type: number
- description: The height for the resized photo
in: query
name: height
required: true
schema:
example: 165
type: number
- description: The opacity for the resized photo
in: query
name: opacity
required: true
schema:
default: 100
maximum: 100
minimum: 1
type: integer
- description: The width for the resized photo
in: query
name: blur
required: true
schema:
examples:
- 0
- 20
- 4000
type: number
- description: images are always scaled proportionally. A value of '1' in minSize will make the smaller native dimension the dimension resized against.
in: query
name: minSize
required: true
schema:
enum:
- 0
- 1
type: integer
- description: allow images to be resized beyond native dimensions.
in: query
name: upscale
required: true
schema:
enum:
- 0
- 1
type: integer
- description: path to image within Plex
in: query
name: url
required: true
schema:
example: /library/metadata/49564/thumb/1654258204
type: string
responses:
"200":
description: Resized Image
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get a Resized Photo
tags:
- Server
x-codeSamples:
- label: getResizedPhoto
lang: php
source: |-
<?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('Postman')
->setSecurity($security)->build();
try {
$request = new Operations\GetResizedPhotoRequest();
$request->width = 110;
$request->height = 165;
$request->opacity = 643869;
$request->blur = 4000;
$request->minSize = Operations\MinSize::Zero;
$request->upscale = Operations\Upscale::Zero;
$request->url = '/library/metadata/49564/thumb/1654258204';;
$response = $sdk->server->getResizedPhoto($request);
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getResizedPhoto
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n\nreq = ::OpenApiSDK::Operations::GetResizedPhotoRequest.new(\n width: 110.0,\n height: 165.0,\n opacity: 643869,\n blur: 4000.0,\n min_size: ::OpenApiSDK::Operations::MinSize::ZERO,\n upscale: ::OpenApiSDK::Operations::Upscale::ZERO,\n url: \"/library/metadata/49564/thumb/1654258204\",\n)\n \nres = s.server.get_resized_photo(req)\n\nif res.status_code == 200\n # handle response\nend"
- label: getResizedPhoto
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
request := operations.GetResizedPhotoRequest{
Width: 110,
Height: 165,
Opacity: 100,
Blur: 20,
MinSize: operations.MinSizeOne,
Upscale: operations.UpscaleZero,
URL: "/library/metadata/49564/thumb/1654258204",
}
ctx := context.Background()
res, err := s.Server.GetResizedPhoto(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: getResizedPhoto
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetResizedPhotoRequest req = GetResizedPhotoRequest.builder()
.width(110d)
.height(165d)
.opacity(643869L)
.blur(4000d)
.minSize(MinSize.ZERO)
.upscale(Upscale.ZERO)
.url("/library/metadata/49564/thumb/1654258204")
.build();
GetResizedPhotoResponse res = sdk.server().getResizedPhoto()
.request(req)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.GetResizedPhotoResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getResizedPhoto
lang: typescript
source: |-
import { MinSize, PlexAPI, Upscale } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getResizedPhoto({
width: 110,
height: 165,
opacity: 100,
blur: 20,
minSize: MinSize.One,
upscale: Upscale.Zero,
url: "/library/metadata/49564/thumb/1654258204",
});
// Handle the result
console.log(result)
}
run();
/pins:
post:
description: Retrieve a Pin from Plex.tv for authentication flows
operationId: getPin
parameters:
- description: |
Determines the kind of code returned by the API call
Strong codes are used for Pin authentication flows
Non-Strong codes are used for `Plex.tv/link`
in: query
name: strong
required: false
schema:
default: false
type: boolean
- description: |
The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
in: header
name: X-Plex-Client-Identifier
required: true
schema:
example: Postman
type: string
- description: |
Product name of the application shown in the list of devices
in: header
name: X-Plex-Product
required: true
schema:
example: Postman
type: string
responses:
"201":
content:
application/json:
schema:
properties:
authToken:
format: nullable
type: string
clientIdentifier:
example: Postman
type: string
code:
example: 3patfx1a78ukcbr7x0n9bl26t
type: string
createdAt:
example: 2023-04-12T17:00:03Z
format: date-time
type: string
expiresAt:
example: 2023-04-12T17:30:03Z
format: date-time
type: string
expiresIn:
example: 1800
type: number
id:
description: PinID for use with authentication
example: 1272322473
type: number
location:
properties:
city:
example: Austin
type: string
code:
example: US
type: string
continent_code:
example: NA
type: string
coordinates:
example: 30.3768 -97.8935
type: string
country:
example: United States
type: string
european_union_member:
type: boolean
in_privacy_restricted_country:
type: boolean
postal_code:
example: 78732
type: string
subdivisions:
example: Texas
type: string
time_zone:
example: America/Chicago
type: string
type: object
newRegistration:
type:
- boolean
- "null"
product:
example: Plex Web
type: string
qr:
description: "a link to a QR code hosted on plex.tv \nThe QR code redirects to the relevant `plex.tv/link` authentication page\nWhich then prompts the user for the 4 Digit Link Pin\n"
example: https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t
type: string
trusted:
type: boolean
type: object
description: The Pin
"400":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1000
type: number
message:
example: X-Plex-Client-Identifier is missing
type: string
status:
example: 400
type: number
type: object
type: array
type: object
description: X-Plex-Client-Identifier is missing
security: []
servers:
- url: https://plex.tv/api/v2
summary: Get a Pin
tags:
- Plex
x-codeSamples:
- label: getPin
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->build();\n\ntry {\n \n\n $response = $sdk->plex->getPin('Postman', false, 'Postman');\n\n if ($response->twoHundredAndOneApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getPin
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\n\n \nres = s.plex.get_pin(x_plex_product=\"Postman\", strong=false, x_plex_client_identifier=\"Postman\")\n\nif ! res.two_hundred_and_one_application_json_object.nil?\n # handle response\nend"
- label: getPin
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithXPlexClientIdentifier("Postman"),
)
var xPlexProduct string = "Postman"
var strong *bool = plexgo.Bool(false)
var xPlexClientIdentifier *string = plexgo.String("Postman")
ctx := context.Background()
res, err := s.Plex.GetPin(ctx, xPlexProduct, strong, xPlexClientIdentifier)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getPin
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.xPlexClientIdentifier("Postman")
.build();
GetPinResponse res = sdk.plex().getPin()
.strong(false)
.xPlexClientIdentifier("Postman")
.xPlexProduct("Postman")
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetPinResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getPin
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.plex.getPin("Postman", false, "Postman");
// Handle the result
console.log(result)
}
run();
/pins/{pinID}:
get:
description: Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
operationId: getToken
parameters:
- description: The PinID to retrieve an access token for
in: path
name: pinID
required: true
schema:
type: string
- description: |
The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
in: header
name: X-Plex-Client-Identifier
required: true
schema:
example: Postman
type: string
responses:
"200":
content:
application/json:
schema:
properties:
authToken:
format: nullable
type: string
clientIdentifier:
example: Postman
type: string
code:
example: 3patfx1a78ukcbr7x0n9bl26t
type: string
createdAt:
example: 2023-04-12T17:00:03Z
format: date-time
type: string
expiresAt:
example: 2023-04-12T17:30:03Z
format: date-time
type: string
expiresIn:
example: 1800
type: number
id:
description: PinID for use with authentication
example: 1272322473
type: number
location:
properties:
city:
example: Austin
type: string
code:
example: US
type: string
continent_code:
example: NA
type: string
coordinates:
example: 30.3768 -97.8935
type: string
country:
example: United States
type: string
european_union_member:
type: boolean
in_privacy_restricted_country:
type: boolean
postal_code:
example: 78732
type: string
subdivisions:
example: Texas
type: string
time_zone:
example: America/Chicago
type: string
type: object
newRegistration:
format: nullable
type: string
product:
example: Plex Web
type: string
qr:
description: "a link to a QR code hosted on plex.tv \nThe QR code redirects to the relevant `plex.tv/link` authentication page\nWhich then prompts the user for the 4 Digit Link Pin\n"
example: https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t
type: string
trusted:
type: boolean
type: object
description: Access Token
"400":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1000
type: number
message:
example: X-Plex-Client-Identifier is missing
type: string
status:
example: 400
type: number
type: object
type: array
type: object
description: X-Plex-Client-Identifier is missing
security: []
servers:
- url: https://plex.tv/api/v2
summary: Get Access Token
tags:
- Plex
x-codeSamples:
- label: getToken
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->build();\n\ntry {\n \n\n $response = $sdk->plex->getToken('<value>', 'Postman');\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getToken
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\n\n \nres = s.plex.get_token(pin_id=\"<value>\", x_plex_client_identifier=\"Postman\")\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getToken
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithXPlexClientIdentifier("Postman"),
)
var pinID string = "<value>"
var xPlexClientIdentifier *string = plexgo.String("Postman")
ctx := context.Background()
res, err := s.Plex.GetToken(ctx, pinID, xPlexClientIdentifier)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getToken
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.xPlexClientIdentifier("Postman")
.build();
GetTokenResponse res = sdk.plex().getToken()
.pinID("<value>")
.xPlexClientIdentifier("Postman")
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetTokenResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getToken
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.plex.getToken("<value>", "Postman");
// Handle the result
console.log(result)
}
run();
/playlists:
get:
description: Get All Playlists given the specified filters.
operationId: getPlaylists
parameters:
- description: limit to a type of playlist.
in: query
name: playlistType
required: false
schema:
enum:
- audio
- video
- photo
type: string
- description: type of playlists to return (default is all).
in: query
name: smart
required: false
schema:
enum:
- 0
- 1
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
addedAt:
example: 1705716298
format: int32
type: integer
composite:
example: /playlists/92/composite/1705716440
type: string
duration:
example: 7328000
format: int32
type: integer
guid:
example: com.plexapp.agents.none://7ca5aaef-58e8-4828-9e21-c009c97f2903
type: string
icon:
example: playlist://image.smart
type: string
key:
example: /playlists/92/items
type: string
lastViewedAt:
example: 1705716298
format: int32
type: integer
leafCount:
example: 32
format: int32
type: integer
playlistType:
example: video
type: string
ratingKey:
example: "92"
type: string
smart:
example: false
type: boolean
summary:
example: A Great Playlist
type: string
title:
example: Static Playlist
type: string
type:
example: playlist
type: string
updatedAt:
example: 1705716440
format: int32
type: integer
viewCount:
example: 1
format: int32
type: integer
type: object
type: array
size:
example: 4
format: int32
type: integer
type: object
type: object
description: returns all playlists
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get All Playlists
tags:
- Playlists
x-codeSamples:
- label: getPlaylists
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->getPlaylists(Operations\\PlaylistType::Audio, Operations\\QueryParamSmart::Zero);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getPlaylists
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.get_playlists(playlist_type=::OpenApiSDK::Operations::PlaylistType::AUDIO, smart=::OpenApiSDK::Operations::QueryParamSmart::ZERO)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getPlaylists
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var playlistType *operations.PlaylistType = operations.PlaylistTypeAudio.ToPointer()
var smart *operations.QueryParamSmart = operations.QueryParamSmartZero.ToPointer()
ctx := context.Background()
res, err := s.Playlists.GetPlaylists(ctx, playlistType, smart)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getPlaylists
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetPlaylistsResponse res = sdk.playlists().getPlaylists()
.playlistType(PlaylistType.AUDIO)
.smart(QueryParamSmart.ZERO)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetPlaylistsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getPlaylists
lang: typescript
source: |-
import { PlaylistType, PlexAPI, QueryParamSmart } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.getPlaylists(PlaylistType.Audio, QueryParamSmart.Zero);
// Handle the result
console.log(result)
}
run();
post:
description: |
Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass:
- `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`).
- `playQueueID` - To create a playlist from an existing play queue.
operationId: createPlaylist
parameters:
- description: name of the playlist
in: query
name: title
required: true
schema:
type: string
- description: type of playlist to create
in: query
name: type
required: true
schema:
enum:
- audio
- video
- photo
type: string
- description: whether the playlist is smart or not
in: query
name: smart
required: true
schema:
enum:
- 0
- 1
type: integer
- description: the content URI for the playlist
in: query
name: uri
required: true
schema:
type: string
- description: the play queue to copy to a playlist
in: query
name: playQueueID
required: false
schema:
type: number
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
addedAt:
example: 1705719589
format: int32
type: integer
composite:
example: /playlists/96/composite/1705724593
type: string
duration:
example: 141000
format: int32
type: integer
guid:
example: com.plexapp.agents.none://a2f92937-1408-40e2-b022-63a8a9377e55
type: string
icon:
example: playlist://image.smart
type: string
key:
example: /playlists/96/items
type: string
lastViewedAt:
example: 1705719589
format: int32
type: integer
leafCount:
example: 1
format: int32
type: integer
playlistType:
example: video
type: string
ratingKey:
example: "96"
type: string
smart:
example: false
type: boolean
summary:
example: What a great playlist
type: string
title:
example: A Great Playlist
type: string
type:
example: playlist
type: string
updatedAt:
example: 1705724593
format: int32
type: integer
viewCount:
example: 1
format: int32
type: integer
type: object
type: array
size:
example: 7
format: int32
type: integer
type: object
type: object
description: returns all playlists
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Create a Playlist
tags:
- Playlists
x-codeSamples:
- label: createPlaylist
lang: php
source: |-
<?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('Postman')
->setSecurity($security)->build();
try {
$request = new Operations\CreatePlaylistRequest();
$request->title = '<value>';
$request->type = Operations\QueryParamType::Photo;
$request->smart = Operations\Smart::One;
$request->uri = 'https://inborn-brochure.biz';
$request->playQueueID = 3686.33;;
$response = $sdk->playlists->createPlaylist($request);
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: createPlaylist
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n\nreq = ::OpenApiSDK::Operations::CreatePlaylistRequest.new(\n title: \"<value>\",\n type: ::OpenApiSDK::Operations::QueryParamType::PHOTO,\n smart: ::OpenApiSDK::Operations::Smart::ONE,\n uri: \"https://inborn-brochure.biz\",\n)\n \nres = s.playlists.create_playlist(req)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: createPlaylist
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
request := operations.CreatePlaylistRequest{
Title: "<value>",
Type: operations.QueryParamTypePhoto,
Smart: operations.SmartOne,
URI: "https://inborn-brochure.biz",
}
ctx := context.Background()
res, err := s.Playlists.CreatePlaylist(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: createPlaylist
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
CreatePlaylistRequest req = CreatePlaylistRequest.builder()
.title("<value>")
.type(QueryParamType.PHOTO)
.smart(Smart.ONE)
.uri("<value>")
.build();
CreatePlaylistResponse res = sdk.playlists().createPlaylist()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.CreatePlaylistResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: createPlaylist
lang: typescript
source: |-
import { PlexAPI, QueryParamType, Smart } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.createPlaylist({
title: "<value>",
type: QueryParamType.Photo,
smart: Smart.One,
uri: "https://inborn-brochure.biz",
});
// Handle the result
console.log(result)
}
run();
/playlists/{playlistID}:
delete:
description: |
This endpoint will delete a playlist
operationId: deletePlaylist
parameters:
- description: the ID of the playlist
in: path
name: playlistID
required: true
schema:
type: number
responses:
"204":
description: The playlist is deleted
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Deletes a Playlist
tags:
- Playlists
x-codeSamples:
- label: deletePlaylist
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->deletePlaylist(216.22);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: deletePlaylist
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.delete_playlist(playlist_id=216.22)\n\nif res.status_code == 200\n # handle response\nend"
- label: deletePlaylist
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var playlistID float64 = 216.22
ctx := context.Background()
res, err := s.Playlists.DeletePlaylist(ctx, playlistID)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: deletePlaylist
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
DeletePlaylistResponse res = sdk.playlists().deletePlaylist()
.playlistID(216.22d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.DeletePlaylistResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: deletePlaylist
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.deletePlaylist(216.22);
// Handle the result
console.log(result)
}
run();
get:
description: |
Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item:
Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing.
operationId: getPlaylist
parameters:
- description: the ID of the playlist
in: path
name: playlistID
required: true
schema:
type: number
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
addedAt:
example: 1705716493
format: int32
type: integer
composite:
example: /playlists/95/composite/1705717387
type: string
content:
example: library://x/directory/%2Flibrary%2Fsections%2F1%2Fall%3Ftype%3D1%26push%3D1%26title%3D2%26or%3D1%26title%3DSerenity%26pop%3D1
type: string
duration:
example: 282000
format: int32
type: integer
guid:
example: com.plexapp.agents.none://87425529-380f-44b8-a689-9a0537e7ec91
type: string
icon:
example: playlist://image.smart
type: string
key:
example: /playlists/95/items
type: string
leafCount:
example: 2
format: int32
type: integer
playlistType:
example: video
type: string
ratingKey:
example: "95"
type: string
smart:
example: true
type: boolean
summary:
example: ""
type: string
title:
example: Smart Movie Playlist
type: string
type:
example: playlist
type: string
updatedAt:
example: 1705717387
format: int32
type: integer
type: object
type: array
size:
example: 1
format: int32
type: integer
type: object
type: object
description: The playlist
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Retrieve Playlist
tags:
- Playlists
x-codeSamples:
- label: getPlaylist
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->getPlaylist(4109.48);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getPlaylist
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.get_playlist(playlist_id=4109.48)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getPlaylist
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var playlistID float64 = 4109.48
ctx := context.Background()
res, err := s.Playlists.GetPlaylist(ctx, playlistID)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getPlaylist
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetPlaylistResponse res = sdk.playlists().getPlaylist()
.playlistID(4109.48d)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetPlaylistResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getPlaylist
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.getPlaylist(4109.48);
// Handle the result
console.log(result)
}
run();
put:
description: |
From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
operationId: updatePlaylist
parameters:
- description: the ID of the playlist
in: path
name: playlistID
required: true
schema:
type: number
- description: name of the playlist
in: query
name: title
required: false
schema:
type: string
- description: summary description of the playlist
in: query
name: summary
required: false
schema:
type: string
responses:
"200":
description: The playlist is deleted
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Update a Playlist
tags:
- Playlists
x-codeSamples:
- label: updatePlaylist
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->updatePlaylist(3915, '<value>', '<value>');\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: updatePlaylist
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.update_playlist(playlist_id=3915, title=\"<value>\", summary=\"<value>\")\n\nif res.status_code == 200\n # handle response\nend"
- label: updatePlaylist
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var playlistID float64 = 3915
var title *string = plexgo.String("<value>")
var summary *string = plexgo.String("<value>")
ctx := context.Background()
res, err := s.Playlists.UpdatePlaylist(ctx, playlistID, title, summary)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: updatePlaylist
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
UpdatePlaylistResponse res = sdk.playlists().updatePlaylist()
.playlistID(3915d)
.title("<value>")
.summary("<value>")
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.UpdatePlaylistResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: updatePlaylist
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.updatePlaylist(3915, "<value>", "<value>");
// Handle the result
console.log(result)
}
run();
/playlists/{playlistID}/items:
delete:
description: |
Clears a playlist, only works with dumb playlists. Returns the playlist.
operationId: clearPlaylistContents
parameters:
- description: the ID of the playlist
in: path
name: playlistID
required: true
schema:
type: number
responses:
"200":
description: The playlist contents are cleared
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Delete Playlist Contents
tags:
- Playlists
x-codeSamples:
- label: clearPlaylistContents
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->clearPlaylistContents(1893.18);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: clearPlaylistContents
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.clear_playlist_contents(playlist_id=1893.18)\n\nif res.status_code == 200\n # handle response\nend"
- label: clearPlaylistContents
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var playlistID float64 = 1893.18
ctx := context.Background()
res, err := s.Playlists.ClearPlaylistContents(ctx, playlistID)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: clearPlaylistContents
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
ClearPlaylistContentsResponse res = sdk.playlists().clearPlaylistContents()
.playlistID(1893.18d)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.ClearPlaylistContentsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: clearPlaylistContents
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.clearPlaylistContents(1893.18);
// Handle the result
console.log(result)
}
run();
get:
description: "Gets the contents of a playlist. Should be paged by clients via standard mechanisms. \nBy default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter. \nFor example, you could use this to display a list of recently added albums vis a smart playlist. \nNote that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.\n"
operationId: getPlaylistContents
parameters:
- description: the ID of the playlist
in: path
name: playlistID
required: true
schema:
type: number
- description: the metadata type of the item to return
in: query
name: type
required: true
schema:
type: number
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Country:
items:
properties:
tag:
example: United States of America
type: string
type: object
type: array
Director:
items:
properties:
tag:
example: Joss Whedon
type: string
type: object
type: array
Genre:
items:
properties:
tag:
example: Action
type: string
type: object
type: array
Media:
items:
properties:
Part:
items:
properties:
audioProfile:
example: lc
type: string
container:
example: mp4
type: string
duration:
example: 141416
format: int32
type: integer
file:
example: /movies/Serenity (2005)/Serenity (2005).mp4
type: string
has64bitOffsets:
example: false
type: boolean
id:
example: 15
format: int32
type: integer
key:
example: /library/parts/15/1705637151/file.mp4
type: string
optimizedForStreaming:
example: false
type: boolean
size:
example: 40271948
format: int32
type: integer
videoProfile:
example: high
type: string
type: object
type: array
aspectRatio:
example: 2.35
type: number
audioChannels:
example: 2
format: int32
type: integer
audioCodec:
example: aac
type: string
audioProfile:
example: lc
type: string
bitrate:
example: 2273
format: int32
type: integer
container:
example: mp4
type: string
duration:
example: 141416
format: int32
type: integer
has64bitOffsets:
example: false
type: boolean
height:
example: 814
format: int32
type: integer
id:
example: 15
format: int32
type: integer
optimizedForStreaming:
example: 0
format: int32
type: integer
videoCodec:
example: h264
type: string
videoFrameRate:
example: 24p
type: string
videoProfile:
example: high
type: string
videoResolution:
example: "1080"
type: string
width:
example: 1920
format: int32
type: integer
type: object
type: array
Role:
items:
properties:
tag:
example: Gina Torres
type: string
type: object
type: array
Writer:
items:
properties:
tag:
example: Joss Whedon
type: string
type: object
type: array
addedAt:
example: 1705637164
format: int32
type: integer
art:
example: /library/metadata/17/art/1705637165
type: string
audienceRating:
example: 9.1
type: number
audienceRatingImage:
example: rottentomatoes://image.rating.upright
type: string
contentRating:
example: PG-13
type: string
duration:
example: 141416
format: int32
type: integer
guid:
example: plex://movie/5d77683f6f4521001ea9dc53
type: string
hasPremiumExtras:
example: "1"
type: string
hasPremiumPrimaryExtra:
example: "1"
type: string
key:
example: /library/metadata/17
type: string
librarySectionID:
example: 1
format: int32
type: integer
librarySectionKey:
example: /library/sections/1
type: string
librarySectionTitle:
example: Movies
type: string
originallyAvailableAt:
example: 2005-09-29T00:00:00Z
format: date
type: string
rating:
example: 8.2
type: number
ratingImage:
example: rottentomatoes://image.rating.ripe
type: string
ratingKey:
example: "17"
type: string
studio:
example: Universal Pictures
type: string
summary:
example: Serenity continues the story of the TV series it was based upon ("Firefly"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.
type: string
tagline:
example: They aim to misbehave.
type: string
thumb:
example: /library/metadata/17/thumb/1705637165
type: string
title:
example: Serenity
type: string
titleSort:
example: Amazing Spider-Man 2
type: string
type:
example: movie
type: string
updatedAt:
example: 1705637165
format: int32
type: integer
year:
example: 2005
format: int32
type: integer
type: object
type: array
composite:
example: /playlists/95/composite/1705717521
type: string
duration:
example: 282
format: int32
type: integer
leafCount:
example: 2
format: int32
type: integer
playlistType:
example: video
type: string
ratingKey:
example: "95"
type: string
size:
example: 2
format: int32
type: integer
smart:
example: true
type: boolean
title:
example: Smart Movie Playlist
type: string
type: object
type: object
description: The playlist contents
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Retrieve Playlist Contents
tags:
- Playlists
x-codeSamples:
- label: getPlaylistContents
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->getPlaylistContents(5004.46, 9403.59);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getPlaylistContents
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.get_playlist_contents(playlist_id=5004.46, type=9403.59)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getPlaylistContents
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var playlistID float64 = 5004.46
var type_ float64 = 9403.59
ctx := context.Background()
res, err := s.Playlists.GetPlaylistContents(ctx, playlistID, type_)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getPlaylistContents
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetPlaylistContentsResponse res = sdk.playlists().getPlaylistContents()
.playlistID(5004.46d)
.type(9403.59d)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetPlaylistContentsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getPlaylistContents
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.getPlaylistContents(5004.46, 9403.59);
// Handle the result
console.log(result)
}
run();
put:
description: |
Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist.
With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.
operationId: addPlaylistContents
parameters:
- description: the ID of the playlist
in: path
name: playlistID
required: true
schema:
type: number
- description: the content URI for the playlist
in: query
name: uri
required: true
schema:
example: server://12345/com.plexapp.plugins.library/library/metadata/1
type: string
- description: the play queue to add to a playlist
in: query
name: playQueueID
required: false
schema:
example: 123
type: number
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
addedAt:
example: 1705716458
format: int32
type: integer
composite:
example: /playlists/94/composite/1705800070
type: string
duration:
example: 423000
format: int32
type: integer
guid:
example: com.plexapp.agents.none://972e3047-83d6-4848-a000-261f0af26ba2
type: string
key:
example: /playlists/94/items
type: string
leafCount:
example: 3
format: int32
type: integer
playlistType:
example: video
type: string
ratingKey:
example: "94"
type: string
smart:
example: false
type: boolean
summary:
example: One of my great playlists
type: string
title:
example: A great playlist
type: string
type:
example: playlist
type: string
updatedAt:
example: 1705800070
format: int32
type: integer
type: object
type: array
leafCountAdded:
example: 1
format: int32
type: integer
leafCountRequested:
example: 1
format: int32
type: integer
size:
example: 1
format: int32
type: integer
type: object
type: object
description: Playlist Updated
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Adding to a Playlist
tags:
- Playlists
x-codeSamples:
- label: addPlaylistContents
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->addPlaylistContents(8502.01, 'server://12345/com.plexapp.plugins.library/library/metadata/1', 123);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: addPlaylistContents
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.add_playlist_contents(playlist_id=8502.01, uri=\"server://12345/com.plexapp.plugins.library/library/metadata/1\", play_queue_id=123.0)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: addPlaylistContents
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var playlistID float64 = 8502.01
var uri string = "server://12345/com.plexapp.plugins.library/library/metadata/1"
var playQueueID *float64 = plexgo.Float64(123)
ctx := context.Background()
res, err := s.Playlists.AddPlaylistContents(ctx, playlistID, uri, playQueueID)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: addPlaylistContents
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
AddPlaylistContentsResponse res = sdk.playlists().addPlaylistContents()
.playlistID(8502.01d)
.uri("server://12345/com.plexapp.plugins.library/library/metadata/1")
.playQueueID(123d)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.AddPlaylistContentsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: addPlaylistContents
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.addPlaylistContents(8502.01, "server://12345/com.plexapp.plugins.library/library/metadata/1", 123);
// Handle the result
console.log(result)
}
run();
/playlists/upload:
post:
description: |
Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file.
operationId: uploadPlaylist
parameters:
- description: "absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server. \nIf the `path` argument is a directory, that path will be scanned for playlist files to be processed. \nEach file in that directory creates a separate playlist, with a name based on the filename of the file that created it. \nThe GUID of each playlist is based on the filename. \nIf the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it. \nThe GUID of each playlist is based on the filename.\n"
in: query
name: path
required: true
schema:
example: /home/barkley/playlist.m3u
type: string
- description: "Force overwriting of duplicate playlists. \nBy default, a playlist file uploaded with the same path will overwrite the existing playlist. \nThe `force` argument is used to disable overwriting. \nIf the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.\n"
in: query
name: force
required: true
schema:
enum:
- 0
- 1
type: integer
responses:
"200":
description: The playlist is uploaded
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Upload Playlist
tags:
- Playlists
x-codeSamples:
- label: uploadPlaylist
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->playlists->uploadPlaylist('/home/barkley/playlist.m3u', Operations\\Force::Zero);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: uploadPlaylist
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.playlists.upload_playlist(path=\"/home/barkley/playlist.m3u\", force=::OpenApiSDK::Operations::Force::ZERO)\n\nif res.status_code == 200\n # handle response\nend"
- label: uploadPlaylist
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var path string = "/home/barkley/playlist.m3u"
var force operations.Force = operations.ForceZero
ctx := context.Background()
res, err := s.Playlists.UploadPlaylist(ctx, path, force)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: uploadPlaylist
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
UploadPlaylistResponse res = sdk.playlists().uploadPlaylist()
.path("/home/barkley/playlist.m3u")
.force(Force.ZERO)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.UploadPlaylistResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: uploadPlaylist
lang: typescript
source: |-
import { Force, PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.playlists.uploadPlaylist("/home/barkley/playlist.m3u", Force.Zero);
// Handle the result
console.log(result)
}
run();
/search:
get:
description: This will search the database for the string provided.
operationId: getSearchResults
parameters:
- description: The search query string to use
in: query
name: query
required: true
schema:
example: "110"
type: string
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Country:
items:
properties:
tag:
example: United States of America
type: string
type: object
type: array
Director:
items:
properties:
tag:
example: Brian De Palma
type: string
type: object
type: array
Genre:
items:
properties:
tag:
example: Action
type: string
type: object
type: array
Media:
items:
properties:
Part:
items:
properties:
audioProfile:
example: lc
type: string
container:
example: mkv
type: string
duration:
example: 6612628
type: number
file:
example: /movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv
type: string
id:
example: 26610
type: number
key:
example: /library/parts/26610/1589234571/file.mkv
type: string
size:
example: 3926903851
type: number
videoProfile:
example: main 10
type: string
type: object
type: array
aspectRatio:
example: 2.35
type: number
audioChannels:
example: 6
type: number
audioCodec:
example: aac
type: string
audioProfile:
example: lc
type: string
bitrate:
example: 4751
type: number
container:
example: mkv
type: string
duration:
example: 6612628
type: number
height:
example: 796
type: number
id:
example: 26610
type: number
videoCodec:
example: hevc
type: string
videoFrameRate:
example: 24p
type: string
videoProfile:
example: main 10
type: string
videoResolution:
example: 1080
type: number
width:
example: 1916
type: number
type: object
type: array
Role:
items:
properties:
tag:
example: Tom Cruise
type: string
type: object
type: array
Writer:
items:
properties:
tag:
example: David Koepp
type: string
type: object
type: array
addedAt:
example: 1589234571
type: number
allowSync:
type: boolean
art:
example: /library/metadata/10398/art/1679505055
type: string
audienceRating:
example: 7.1
type: number
audienceRatingImage:
example: rottentomatoes://image.rating.upright
type: string
chapterSource:
example: media
type: string
contentRating:
example: PG-13
type: string
duration:
example: 6612628
type: number
guid:
example: plex://movie/5d7768284de0ee001fcc8f52
type: string
key:
example: /library/metadata/10398
type: string
librarySectionID:
example: 1
type: number
librarySectionTitle:
example: Movies
type: string
librarySectionUUID:
example: 322a231a-b7f7-49f5-920f-14c61199cd30
type: string
originallyAvailableAt:
example: 1996-05-22T00:00:00Z
format: date-time
type: string
personal:
type: boolean
primaryExtraKey:
example: /library/metadata/10501
type: string
rating:
example: 6.6
type: number
ratingImage:
example: rottentomatoes://image.rating.ripe
type: string
ratingKey:
example: 10398
type: number
sourceTitle:
example: Hera
type: string
studio:
example: Paramount
type: string
summary:
example: When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score.
type: string
tagline:
example: Expect the impossible.
type: string
thumb:
example: /library/metadata/10398/thumb/1679505055
type: string
title:
example: 'Mission: Impossible'
type: string
type:
example: movie
type: string
updatedAt:
example: 1679505055
type: number
year:
example: 1996
type: number
type: object
type: array
Provider:
items:
properties:
key:
example: /system/search
type: string
title:
example: Local Network
type: string
type:
example: mixed
type: string
type: object
type: array
identifier:
example: com.plexapp.plugins.library
type: string
mediaTagPrefix:
example: /system/bundle/media/flags/
type: string
mediaTagVersion:
example: 1680021154
type: number
size:
example: 26
type: number
type: object
type: object
description: Search Results
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Search Results
tags:
- Search
x-codeSamples:
- label: getSearchResults
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->search->getSearchResults('110');\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getSearchResults
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.search.get_search_results(query=\"110\")\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getSearchResults
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var query string = "110"
ctx := context.Background()
res, err := s.Search.GetSearchResults(ctx, query)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getSearchResults
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetSearchResultsResponse res = sdk.search().getSearchResults()
.query("110")
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetSearchResultsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getSearchResults
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.search.getSearchResults("110");
// Handle the result
console.log(result)
}
run();
/security/resources:
get:
description: |
If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
Note: requires Plex Media Server >= 1.15.4.
operationId: getSourceConnectionInformation
parameters:
- description: The source identifier with an included prefix.
in: query
name: source
required: true
schema:
examples:
- server://client-identifier
- provider://provider-identifier
type: string
responses:
"200":
description: Source Connection Information
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Source Connection Information
tags:
- Authentication
x-codeSamples:
- label: getSourceConnectionInformation
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->authentication->getSourceConnectionInformation('server://client-identifier');\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getSourceConnectionInformation
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.authentication.get_source_connection_information(source=\"server://client-identifier\")\n\nif res.status_code == 200\n # handle response\nend"
- label: getSourceConnectionInformation
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var source string = "server://client-identifier"
ctx := context.Background()
res, err := s.Authentication.GetSourceConnectionInformation(ctx, source)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: getSourceConnectionInformation
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetSourceConnectionInformationResponse res = sdk.authentication().getSourceConnectionInformation()
.source("server://client-identifier")
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.GetSourceConnectionInformationResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getSourceConnectionInformation
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.authentication.getSourceConnectionInformation("server://client-identifier");
// Handle the result
console.log(result)
}
run();
/security/token:
get:
description: |
This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.
operationId: getTransientToken
parameters:
- description: '`delegation` - This is the only supported `type` parameter.'
in: query
name: type
required: true
schema:
enum:
- delegation
type: string
- description: '`all` - This is the only supported `scope` parameter.'
in: query
name: scope
required: true
schema:
enum:
- all
type: string
responses:
"200":
description: A Transient Token
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get a Transient Token.
tags:
- Authentication
x-codeSamples:
- label: getTransientToken
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->authentication->getTransientToken(Operations\\GetTransientTokenQueryParamType::Delegation, Operations\\Scope::All);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getTransientToken
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.authentication.get_transient_token(type=::OpenApiSDK::Operations::GetTransientTokenQueryParamType::DELEGATION, scope=::OpenApiSDK::Operations::Scope::ALL)\n\nif res.status_code == 200\n # handle response\nend"
- label: getTransientToken
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var type_ operations.GetTransientTokenQueryParamType = operations.GetTransientTokenQueryParamTypeDelegation
var scope operations.Scope = operations.ScopeAll
ctx := context.Background()
res, err := s.Authentication.GetTransientToken(ctx, type_, scope)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: getTransientToken
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetTransientTokenResponse res = sdk.authentication().getTransientToken()
.type(GetTransientTokenQueryParamType.DELEGATION)
.scope(Scope.ALL)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.GetTransientTokenResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getTransientToken
lang: typescript
source: |-
import { GetTransientTokenQueryParamType, PlexAPI, Scope } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.authentication.getTransientToken(GetTransientTokenQueryParamType.Delegation, Scope.All);
// Handle the result
console.log(result)
}
run();
/servers:
get:
description: Get Server List
operationId: getServerList
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Server:
items:
properties:
address:
example: 10.10.10.47
type: string
host:
example: 10.10.10.47
type: string
machineIdentifier:
example: 96f2fe7a78c9dc1f16a16bedbe90f98149be16b4
type: string
name:
example: Hera
type: string
port:
example: 32400
type: number
version:
example: 1.31.3.6868-28fc46b27
type: string
type: object
type: array
size:
example: 1
type: number
type: object
type: object
description: List of Servers
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Server List
tags:
- Server
x-codeSamples:
- label: getServerList
lang: php
source: |-
<?php
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->server->getServerList();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getServerList
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.server.get_server_list()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getServerList
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Server.GetServerList(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getServerList
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetServerListResponse res = sdk.server().getServerList()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetServerListResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getServerList
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.server.getServerList();
// Handle the result
console.log(result)
}
run();
/statistics/bandwidth:
get:
description: This will return the bandwidth statistics for the server
operationId: getBandwidthStatistics
parameters:
- description: |
The timespan to retrieve statistics for
the exact meaning of this parameter is not known
example: 4
in: query
name: Timespan
required: false
schema:
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Account:
items:
properties:
autoSelectAudio:
example: true
type: boolean
defaultAudioLanguage:
example: en
type: string
defaultSubtitleLanguage:
example: en
type: string
id:
example: 238960586
format: int32
type: integer
key:
example: /accounts/238960586
type: string
name:
example: Diane
type: string
subtitleMode:
example: 1
format: int32
type: integer
thumb:
example: https://plex.tv/users/50d83634246da1de/avatar?c=1707110967
type: string
type: object
type: array
Device:
items:
properties:
clientIdentifier:
example: 793095d235660625108ef785cc7646e9
type: string
createdAt:
example: 1706470556
format: int32
type: integer
id:
example: 208
format: int32
type: integer
name:
example: Roku Express
type: string
platform:
example: Roku
type: string
type: object
type: array
StatisticsBandwidth:
items:
properties:
accountID:
example: 238960586
format: int32
type: integer
at:
example: 1718387650
format: int32
type: integer
bytes:
example: 22
type: integer
deviceID:
exmaple: 208
format: int32
type: integer
lan:
example: true
type: boolean
timespan:
example: 6
type: integer
type: object
type: array
size:
example: 5497
format: int32
type: integer
type: object
type: object
description: Bandwidth Statistics
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Bandwidth Statistics
tags:
- Statistics
x-codeSamples:
- label: getBandwidthStatistics
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->statistics->getBandwidthStatistics(4);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getBandwidthStatistics
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.statistics.get_bandwidth_statistics(timespan=4)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getBandwidthStatistics
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var timespan *int64 = plexgo.Int64(4)
ctx := context.Background()
res, err := s.Statistics.GetBandwidthStatistics(ctx, timespan)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getBandwidthStatistics
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetBandwidthStatisticsResponse res = sdk.statistics().getBandwidthStatistics()
.timespan(4L)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetBandwidthStatisticsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getBandwidthStatistics
lang: typescript
source: |-
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();
/statistics/media:
get:
description: This will return the media statistics for the server
operationId: getStatistics
parameters:
- description: |
The timespan to retrieve statistics for
the exact meaning of this parameter is not known
example: 4
in: query
name: Timespan
required: false
schema:
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Account:
items:
properties:
autoSelectAudio:
example: true
type: boolean
defaultAudioLanguage:
example: en
type: string
defaultSubtitleLanguage:
example: en
type: string
id:
example: 238960586
format: int32
type: integer
key:
example: /accounts/238960586
type: string
name:
example: Diane
type: string
subtitleMode:
example: 1
format: int32
type: integer
thumb:
example: https://plex.tv/users/50d83634246da1de/avatar?c=1707110967
type: string
type: object
type: array
Device:
items:
properties:
clientIdentifier:
example: 793095d235660625108ef785cc7646e9
type: string
createdAt:
example: 1706470556
format: int32
type: integer
id:
example: 208
format: int32
type: integer
name:
example: Roku Express
type: string
platform:
example: Roku
type: string
type: object
type: array
StatisticsMedia:
items:
properties:
accountID:
example: 1
format: int32
type: integer
at:
example: 1707141600
format: int32
type: integer
count:
example: 1
format: int32
type: integer
deviceID:
example: 13
format: int32
type: integer
duration:
example: 1555
format: int32
type: integer
metadataType:
example: 4
format: int32
type: integer
timespan:
example: 4
format: int32
type: integer
type: object
type: array
size:
example: 5497
format: int32
type: integer
type: object
type: object
description: Media Statistics
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Media Statistics
tags:
- Statistics
x-codeSamples:
- label: getStatistics
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->statistics->getStatistics(4);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getStatistics
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.statistics.get_statistics(timespan=4)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getStatistics
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var timespan *int64 = plexgo.Int64(4)
ctx := context.Background()
res, err := s.Statistics.GetStatistics(ctx, timespan)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getStatistics
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetStatisticsResponse res = sdk.statistics().getStatistics()
.timespan(4L)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetStatisticsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getStatistics
lang: typescript
source: |-
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();
/statistics/resources:
get:
description: This will return the resources for the server
operationId: getResourcesStatistics
parameters:
- description: |
The timespan to retrieve statistics for
the exact meaning of this parameter is not known
example: 4
in: query
name: Timespan
required: false
schema:
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
StatisticsResources:
items:
properties:
at:
example: 1718384427
type: integer
hostCpuUtilization:
example: 1.276
format: float
type: number
hostMemoryUtilization:
example: 17.026
format: float
type: number
processCpuUtilization:
example: 0.025
format: float
type: number
processMemoryUtilization:
example: 0.493
format: float
type: number
timespan:
example: 6
type: integer
type: object
type: array
size:
example: 5497
format: int32
type: integer
type: object
type: object
description: Resource Statistics
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Resources Statistics
tags:
- Statistics
x-codeSamples:
- label: getResourcesStatistics
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->statistics->getResourcesStatistics(4);\n\n if ($response->twoHundredApplicationJsonObject !== null) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: getResourcesStatistics
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.statistics.get_resources_statistics(timespan=4)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getResourcesStatistics
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var timespan *int64 = plexgo.Int64(4)
ctx := context.Background()
res, err := s.Statistics.GetResourcesStatistics(ctx, timespan)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getResourcesStatistics
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetResourcesStatisticsResponse res = sdk.statistics().getResourcesStatistics()
.timespan(4L)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetResourcesStatisticsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getResourcesStatistics
lang: typescript
source: |-
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();
/status/sessions:
get:
description: This will retrieve the "Now Playing" Information of the PMS.
operationId: getSessions
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
Media:
items:
properties:
Part:
items:
properties:
Stream:
items:
properties:
albumGain:
example: "-12.94"
type: string
albumPeak:
example: "1.000000"
type: string
albumRange:
example: "4.751014"
type: string
audioChannelLayout:
example: stereo
type: string
bitDepth:
example: 16
format: int32
type: integer
bitrate:
example: 1014
format: int32
type: integer
channels:
example: 2
format: int32
type: integer
codec:
example: flac
type: string
displayTitle:
example: FLAC (Stereo)
type: string
extendedDisplayTitle:
example: FLAC (Stereo)
type: string
gain:
example: "-12.94"
type: string
id:
example: "352487"
type: string
index:
example: 0
format: int32
type: integer
location:
example: direct
type: string
loudness:
example: "-5.94"
type: string
lra:
example: "1.74"
type: string
peak:
example: "1.000000"
type: string
samplingRate:
example: 44100
format: int32
type: integer
selected:
example: true
type: boolean
streamType:
example: 2
format: int32
type: integer
type: object
type: array
container:
example: flac
type: string
decision:
example: directplay
type: string
duration:
example: 186240
format: int32
type: integer
file:
example: /music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac
type: string
hasThumbnail:
example: "1"
type: string
id:
example: "130625"
type: string
key:
example: /library/parts/130625/1705543268/file.flac
type: string
selected:
example: true
type: boolean
size:
example: 23644000
format: int32
type: integer
type: object
type: array
audioChannels:
example: 2
format: int32
type: integer
audioCodec:
example: flac
type: string
bitrate:
example: 1014
format: int32
type: integer
container:
example: flac
type: string
duration:
example: 186240
format: int32
type: integer
id:
example: "130355"
type: string
selected:
example: true
type: boolean
type: object
type: array
Player:
properties:
address:
example: 10.10.10.171
type: string
local:
example: true
type: boolean
machineIdentifier:
example: 3tsdzir85m2onc3qyr255aq1
type: string
model:
example: standalone
type: string
platform:
example: windows
type: string
platformVersion:
example: 10.0.22621
type: string
product:
example: Plex for Windows
type: string
profile:
example: Plex Desktop
type: string
relayed:
example: false
type: boolean
remotePublicAddress:
example: 68.248.140.20
type: string
secure:
example: true
type: boolean
state:
example: playing
type: string
title:
example: DESKTOP-BL80MTD
type: string
userID:
example: 1
format: int32
type: integer
version:
example: 1.85.0.4071-21128b56
type: string
type: object
Session:
properties:
bandwidth:
example: 1050
format: int32
type: integer
id:
example: 93h7e00ncblxncqw9lkfaoxi
type: string
location:
example: lan
type: string
type: object
User:
properties:
id:
example: "1"
type: string
thumb:
example: https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661
type: string
title:
example: Blindkitty38
type: string
type: object
addedAt:
example: 1705543312
format: int32
type: integer
art:
example: /library/metadata/39904/art/1705310687
type: string
duration:
example: 186240
format: int32
type: integer
grandparentArt:
example: /library/metadata/39904/art/1705310687
type: string
grandparentGuid:
example: plex://artist/5d07bbfd403c6402904a6480
type: string
grandparentKey:
example: /library/metadata/39904
type: string
grandparentRatingKey:
example: "39904"
type: string
grandparentThumb:
example: /library/metadata/39904/thumb/1705310687
type: string
grandparentTitle:
example: Green Day
type: string
guid:
example: plex://track/6535834f71f22f36f71a8e8f
type: string
index:
example: 1
format: int32
type: integer
key:
example: /library/metadata/67085
type: string
librarySectionID:
example: "3"
type: string
librarySectionKey:
example: /library/sections/3
type: string
librarySectionTitle:
example: Music
type: string
musicAnalysisVersion:
example: "1"
type: string
parentGuid:
example: plex://album/65394d6d472b8ab03ef47f12
type: string
parentIndex:
example: 1
format: int32
type: integer
parentKey:
example: /library/metadata/67084
type: string
parentRatingKey:
example: "67084"
type: string
parentStudio:
example: Reprise Records
type: string
parentThumb:
example: /library/metadata/67084/thumb/1705543314
type: string
parentTitle:
example: Saviors
type: string
parentYear:
example: 2024
format: int32
type: integer
ratingCount:
example: 45885
format: int32
type: integer
ratingKey:
example: "67085"
type: string
sessionKey:
example: "203"
type: string
thumb:
example: /library/metadata/67084/thumb/1705543314
type: string
title:
example: The American Dream Is Killing Me
type: string
titleSort:
example: American Dream Is Killing Me
type: string
type:
example: track
type: string
updatedAt:
example: 1705543314
format: int32
type: integer
viewOffset:
example: 1000
format: int32
type: integer
type: object
type: array
size:
example: 1
format: int32
type: integer
type: object
type: object
description: List of Active Plex Sessions
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Active Sessions
tags:
- Sessions
x-codeSamples:
- label: getSessions
lang: php
source: |-
<?php
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->sessions->getSessions();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getSessions
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.sessions.get_sessions()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getSessions
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Sessions.GetSessions(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getSessions
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetSessionsResponse res = sdk.sessions().getSessions()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetSessionsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getSessions
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.sessions.getSessions();
// Handle the result
console.log(result)
}
run();
/status/sessions/history/all:
get:
description: This will Retrieve a listing of all history views.
operationId: getSessionHistory
parameters:
- description: |
Sorts the results by the specified field followed by the direction (asc, desc)
examples:
rating-ascending:
value: rating:asc
rating-descending:
value: rating:desc
viewed-at-ascending:
value: viewedAt:asc
viewed-at-descending:
value: viewedAt:desc
in: query
name: sort
required: false
schema:
type: string
- description: |
Filter results by those that are related to a specific users id
example: 1
in: query
name: accountId
required: false
schema:
type: integer
- description: |
Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
examples:
ViewedAt:
value: viewedAt>=1704862818
in: query
name: filter
required: false
schema:
example:
viewed-at-greater-than:
value: viewedAt>
viewed-at-greater-than-or-equal-to:
value: viewedAt>=>
viewed-at-less-than:
value: viewedAt<
pattern: ^[A-Za-z][A-Za-z0-9]*[>=<]{0,2}$
type: object
- description: |
Filters the results based on the id of a valid library section
example: 12
in: query
name: librarySectionID
required: false
schema:
type: integer
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Metadata:
items:
properties:
accountID:
example: 1
format: int32
type: integer
deviceID:
example: 5
format: int32
type: integer
grandparentArt:
example: /library/metadata/32132/art/1703933346
type: string
grandparentKey:
example: /library/metadata/32132
type: string
grandparentThumb:
example: /library/metadata/32132/thumb/1703933346
type: string
grandparentTitle:
example: Taskmaster
type: string
historyKey:
example: /status/sessions/history/1
type: string
index:
example: 1
format: int32
type: integer
key:
example: /library/metadata/32171
type: string
librarySectionID:
example: "2"
type: string
originallyAvailableAt:
example: 2022-04-14T00:00:00Z
format: date
type: string
parentIndex:
example: 13
format: int32
type: integer
parentKey:
example: /library/metadata/32170
type: string
parentThumb:
example: /library/metadata/32170/thumb/1654134301
type: string
ratingKey:
example: "32171"
type: string
thumb:
example: /library/metadata/32171/thumb/-1
type: string
title:
example: The Noise That Blue Makes
type: string
type:
example: episode
type: string
viewedAt:
example: 1654139223
format: int32
type: integer
type: object
type: array
size:
example: 10855
format: int32
type: integer
type: object
type: object
description: List of Plex Sessions
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Session History
tags:
- Sessions
x-codeSamples:
- label: getSessionHistory
lang: php
source: |-
<?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('Postman')
->setSecurity($security)->build();
try {
$filter = new Operations\Filter();
$response = $sdk->sessions->getSessionHistory('<value>', 1, $filter, 12);
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getSessionHistory
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.sessions.get_session_history(sort=\"<value>\", account_id=1, filter=::OpenApiSDK::Operations::Filter.new(), library_section_id=12)\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getSessionHistory
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sort *string = plexgo.String("<value>")
var accountID *int64 = plexgo.Int64(1)
var filter *operations.Filter = &operations.Filter{}
var librarySectionID *int64 = plexgo.Int64(12)
ctx := context.Background()
res, err := s.Sessions.GetSessionHistory(ctx, sort, accountID, filter, librarySectionID)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getSessionHistory
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetSessionHistoryResponse res = sdk.sessions().getSessionHistory()
.sort("<value>")
.accountId(1L)
.filter(Filter.builder()
.build())
.librarySectionID(12L)
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetSessionHistoryResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getSessionHistory
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.sessions.getSessionHistory("<value>", 1, {}, 12);
// Handle the result
console.log(result)
}
run();
/transcode/sessions:
get:
description: Get Transcode Sessions
operationId: getTranscodeSessions
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
TranscodeSession:
example:
- audioChannels: 1
audioCodec: opus
audioDecision: transcode
complete: false
container: mkv
context: streaming
duration: 1445695
error: false
key: vv3i2q2lax92qlzul1hbd4bx
maxOffsetAvailable: 29.53
minOffsetAvailable: 3.003000020980835
progress: 1.7999999523162842
protocol: http
remaining: 53
size: -22
sourceAudioCodec: aac
sourceVideoCodec: h264
speed: 25.100000381469727
subtitleDecision: burn
throttled: false
timeStamp: 1.7058958054919229e+09
transcodeHwRequested: true
videoCodec: h264
videoDecision: transcode
items:
properties:
audioChannels:
example: 1
format: int32
type: integer
audioCodec:
example: opus
type: string
audioDecision:
example: transcode
type: string
complete:
example: false
type: boolean
container:
example: mkv
type: string
context:
example: streaming
type: string
duration:
example: 1445695
format: int32
type: integer
error:
example: false
type: boolean
key:
example: vv3i2q2lax92qlzul1hbd4bx
type: string
maxOffsetAvailable:
example: 29.53
type: number
minOffsetAvailable:
example: 3.003000020980835
type: number
progress:
example: 1.7999999523162842
type: number
protocol:
example: http
type: string
remaining:
example: 53
format: int32
type: integer
size:
example: -22
format: int32
type: integer
sourceAudioCodec:
example: aac
type: string
sourceVideoCodec:
example: h264
type: string
speed:
example: 25.100000381469727
type: number
subtitleDecision:
example: burn
type: string
throttled:
example: false
type: boolean
timeStamp:
example: 1.7058958054919229e+09
type: number
transcodeHwRequested:
example: true
type: boolean
videoCodec:
example: h264
type: string
videoDecision:
example: transcode
type: string
type: object
type: array
size:
example: 1
format: int32
type: integer
type: object
type: object
description: The Transcode Sessions
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Get Transcode Sessions
tags:
- Sessions
x-codeSamples:
- label: getTranscodeSessions
lang: php
source: |-
<?php
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->sessions->getTranscodeSessions();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getTranscodeSessions
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.sessions.get_transcode_sessions()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getTranscodeSessions
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Sessions.GetTranscodeSessions(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getTranscodeSessions
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetTranscodeSessionsResponse res = sdk.sessions().getTranscodeSessions()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetTranscodeSessionsResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getTranscodeSessions
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.sessions.getTranscodeSessions();
// Handle the result
console.log(result)
}
run();
/transcode/sessions/{sessionKey}:
delete:
description: Stop a Transcode Session
operationId: stopTranscodeSession
parameters:
- description: the Key of the transcode session to stop
in: path
name: sessionKey
required: true
schema:
example: zz7llzqlx8w9vnrsbnwhbmep
type: string
responses:
"204":
description: The Transcode Session ended
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Stop a Transcode Session
tags:
- Sessions
x-codeSamples:
- label: stopTranscodeSession
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->sessions->stopTranscodeSession('zz7llzqlx8w9vnrsbnwhbmep');\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: stopTranscodeSession
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.sessions.stop_transcode_session(session_key=\"zz7llzqlx8w9vnrsbnwhbmep\")\n\nif res.status_code == 200\n # handle response\nend"
- label: stopTranscodeSession
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var sessionKey string = "zz7llzqlx8w9vnrsbnwhbmep"
ctx := context.Background()
res, err := s.Sessions.StopTranscodeSession(ctx, sessionKey)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: stopTranscodeSession
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
StopTranscodeSessionResponse res = sdk.sessions().stopTranscodeSession()
.sessionKey("zz7llzqlx8w9vnrsbnwhbmep")
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.StopTranscodeSessionResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: stopTranscodeSession
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.sessions.stopTranscodeSession("zz7llzqlx8w9vnrsbnwhbmep");
// Handle the result
console.log(result)
}
run();
/updater/apply:
put:
description: |
Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
operationId: applyUpdates
parameters:
- description: Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install
example: 1
in: query
name: tonight
required: false
schema:
enum:
- 0
- 1
type: integer
- description: Indicate that the latest version should be marked as skipped. The <Release> entry for this version will have the `state` set to `skipped`.
example: 1
in: query
name: skip
required: false
schema:
enum:
- 0
- 1
type: integer
responses:
"200":
description: If the update process started correctly
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
"500":
description: If the update process failed to start
summary: Apply Updates
tags:
- Updater
x-codeSamples:
- label: applyUpdates
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->updater->applyUpdates(Operations\\Tonight::One, Operations\\Skip::Zero);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: applyUpdates
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.updater.apply_updates(tonight=::OpenApiSDK::Operations::Tonight::ONE, skip=::OpenApiSDK::Operations::Skip::ZERO)\n\nif res.status_code == 200\n # handle response\nend"
- label: applyUpdates
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var tonight *operations.Tonight = operations.TonightOne.ToPointer()
var skip *operations.Skip = operations.SkipOne.ToPointer()
ctx := context.Background()
res, err := s.Updater.ApplyUpdates(ctx, tonight, skip)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: applyUpdates
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
ApplyUpdatesResponse res = sdk.updater().applyUpdates()
.tonight(Tonight.ONE)
.skip(Skip.ONE)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.ApplyUpdatesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: applyUpdates
lang: typescript
source: |-
import { PlexAPI, Skip, Tonight } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.updater.applyUpdates(Tonight.One, Skip.One);
// Handle the result
console.log(result)
}
run();
/updater/check:
put:
description: Checking for updates
operationId: checkForUpdates
parameters:
- description: Indicate that you want to start download any updates found.
example: 1
in: query
name: download
required: false
schema:
enum:
- 0
- 1
type: integer
responses:
"200":
description: The update check is started, if download is set to 1 and the system is able to update automatically, the update download will start.
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Checking for updates
tags:
- Updater
x-codeSamples:
- label: checkForUpdates
lang: php
source: "<?php\n\ndeclare(strict_types=1);\n\nrequire 'vendor/autoload.php';\n\nuse \\LukeHagar\\Plex_API;\nuse \\LukeHagar\\Plex_API\\Models\\Components;\nuse \\LukeHagar\\Plex_API\\Models\\Operations;\n\n$security = new Components\\Security();\n$security->accessToken = '<YOUR_API_KEY_HERE>';\n\n$sdk = Plex_API\\PlexAPI::builder()\n ->setXPlexClientIdentifier('Postman')\n ->setSecurity($security)->build();\n\ntry {\n \n\n $response = $sdk->updater->checkForUpdates(Operations\\Download::One);\n\n if ($response->statusCode === 200) {\n // handle response\n }\n} catch (Throwable $e) {\n // handle exception\n}"
- label: checkForUpdates
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.updater.check_for_updates(download=::OpenApiSDK::Operations::Download::ONE)\n\nif res.status_code == 200\n # handle response\nend"
- label: checkForUpdates
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
var download *operations.Download = operations.DownloadOne.ToPointer()
ctx := context.Background()
res, err := s.Updater.CheckForUpdates(ctx, download)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: checkForUpdates
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
CheckForUpdatesResponse res = sdk.updater().checkForUpdates()
.download(Download.ONE)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.CheckForUpdatesResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: checkForUpdates
lang: typescript
source: |-
import { Download, PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.updater.checkForUpdates(Download.One);
// Handle the result
console.log(result)
}
run();
/updater/status:
get:
description: Querying status of updates
operationId: getUpdateStatus
responses:
"200":
content:
application/json:
schema:
properties:
MediaContainer:
properties:
Release:
example:
- added: |-
(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish.
(Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793)
(Music) Store track genres and add filtering options (#14653)
(Music) Support ID3v2.4 null-separated tags for genres and release type (#14653)
(View History) No longer create a view history entry for items marked as played (#10888)
(Web) Updated to 4.118.0
downloadURL: https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx
fixed: |-
(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483)
(Agents) It is possible that agents are not initialised during startup on rare occasions (#14654)
(Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667)
(Collection) Server could become unresponsive when collection membership changes (#14612)
(DVR) Previously watched recordings could be deleted without being watched again (#13779)
(Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501)
(Library) The Content Rating not equal to None filter does not work (#14620)
(Search) Album search results could contain all the album's tracks too (#14486)
(Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674)
(Transcoder) HW encoding would fail on devices with no rate control (#14222)
(Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)
key: https://plex.tv/updater/releases/5136
state: notify
version: 1.40.0.7775-456fbaf97
items:
properties:
added:
example: |-
(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish.
(Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793)
(Music) Store track genres and add filtering options (#14653)
(Music) Support ID3v2.4 null-separated tags for genres and release type (#14653)
(View History) No longer create a view history entry for items marked as played (#10888)
(Web) Updated to 4.118.0
type: string
downloadURL:
example: https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx
type: string
fixed:
example: |-
(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483)
(Agents) It is possible that agents are not initialised during startup on rare occasions (#14654)
(Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667)
(Collection) Server could become unresponsive when collection membership changes (#14612)
(DVR) Previously watched recordings could be deleted without being watched again (#13779)
(Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501)
(Library) The Content Rating not equal to None filter does not work (#14620)
(Search) Album search results could contain all the album's tracks too (#14486)
(Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674)
(Transcoder) HW encoding would fail on devices with no rate control (#14222)
(Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)
type: string
key:
example: https://plex.tv/updater/releases/5136
type: string
state:
example: notify
type: string
version:
example: 1.40.0.7775-456fbaf97
type: string
type: object
type: array
canInstall:
example: false
type: boolean
checkedAt:
example: 1705801232
format: int32
type: integer
downloadURL:
example: https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx
type: string
size:
example: 1
format: int32
type: integer
status:
example: 0
format: int32
type: integer
type: object
type: object
description: The Server Updates
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Querying status of updates
tags:
- Updater
x-codeSamples:
- label: getUpdateStatus
lang: php
source: |-
<?php
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->updater->getUpdateStatus();
if ($response->twoHundredApplicationJsonObject !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: getUpdateStatus
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n \nres = s.updater.get_update_status()\n\nif ! res.two_hundred_application_json_object.nil?\n # handle response\nend"
- label: getUpdateStatus
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
ctx := context.Background()
res, err := s.Updater.GetUpdateStatus(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- label: getUpdateStatus
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
GetUpdateStatusResponse res = sdk.updater().getUpdateStatus()
.call();
if (res.object().isPresent()) {
// handle response
}
} catch (lukehagar.plexapi.plexapi.models.errors.GetUpdateStatusResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: getUpdateStatus
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.updater.getUpdateStatus();
// Handle the result
console.log(result)
}
run();
/video/:/transcode/universal/start.mpd:
get:
description: Begin a Universal Transcode Session
operationId: startUniversalTranscode
parameters:
- description: Whether the media item has MDE
example: 1
in: query
name: hasMDE
required: true
schema:
type: number
- description: The path to the media item to transcode
example: /library/metadata/23409
in: query
name: path
required: true
schema:
type: string
- description: The index of the media item to transcode
example: 0
in: query
name: mediaIndex
required: true
schema:
type: number
- description: The index of the part to transcode
example: 0
in: query
name: partIndex
required: true
schema:
type: number
- description: The protocol to use for the transcode session
example: hls
in: query
name: protocol
required: true
schema:
type: string
- description: Whether to use fast seek or not
example: 0
in: query
name: fastSeek
required: false
schema:
type: number
- description: Whether to use direct play or not
example: 0
in: query
name: directPlay
required: false
schema:
type: number
- description: Whether to use direct stream or not
example: 0
in: query
name: directStream
required: false
schema:
type: number
- description: The size of the subtitles
example: 100
in: query
name: subtitleSize
required: false
schema:
type: number
- description: The subtitles
example: burn
in: query
name: subtites
required: false
schema:
type: string
- description: The audio boost
example: 100
in: query
name: audioBoost
required: false
schema:
type: number
- description: The location of the transcode session
example: lan
in: query
name: location
required: false
schema:
type: string
- description: The size of the media buffer
example: 102400
in: query
name: mediaBufferSize
required: false
schema:
type: number
- description: The session ID
example: zvcage8b7rkioqcm8f4uns4c
in: query
name: session
required: false
schema:
type: string
- description: Whether to add a debug overlay or not
example: 0
in: query
name: addDebugOverlay
required: false
schema:
type: number
- description: Whether to auto adjust quality or not
example: 0
in: query
name: autoAdjustQuality
required: false
schema:
type: number
responses:
"200":
description: The transcode session has started
"400":
description: Bad Request - A parameter was not specified, or was specified incorrectly.
"401":
content:
application/json:
schema:
properties:
errors:
items:
properties:
code:
example: 1001
type: number
message:
example: User could not be authenticated
type: string
status:
example: 401
type: number
type: object
type: array
type: object
description: Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
summary: Start Universal Transcode
tags:
- Video
x-codeSamples:
- label: startUniversalTranscode
lang: php
source: |-
<?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('Postman')
->setSecurity($security)->build();
try {
$request = new Operations\StartUniversalTranscodeRequest();
$request->hasMDE = 1;
$request->path = '/library/metadata/23409';
$request->mediaIndex = 0;
$request->partIndex = 0;
$request->protocol = 'hls';
$request->fastSeek = 0;
$request->directPlay = 0;
$request->directStream = 0;
$request->subtitleSize = 100;
$request->subtites = 'burn';
$request->audioBoost = 100;
$request->location = 'lan';
$request->mediaBufferSize = 102400;
$request->session = 'zvcage8b7rkioqcm8f4uns4c';
$request->addDebugOverlay = 0;
$request->autoAdjustQuality = 0;;
$response = $sdk->video->startUniversalTranscode($request);
if ($response->statusCode === 200) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
- label: startUniversalTranscode
lang: ruby
source: "require 'plexruby'\n\n\ns = ::OpenApiSDK::PlexAPI.new(\n x_plex_client_identifier: \"Postman\",\n )\ns.config_security(\n ::OpenApiSDK::Shared::Security.new(\n access_token: \"<YOUR_API_KEY_HERE>\",\n )\n)\n\n\nreq = ::OpenApiSDK::Operations::StartUniversalTranscodeRequest.new(\n has_mde: 1.0,\n path: \"/library/metadata/23409\",\n media_index: 0.0,\n part_index: 0.0,\n protocol: \"hls\",\n fast_seek: 0.0,\n direct_play: 0.0,\n direct_stream: 0.0,\n subtitle_size: 100.0,\n subtites: \"burn\",\n audio_boost: 100.0,\n location: \"lan\",\n media_buffer_size: 102400.0,\n session: \"zvcage8b7rkioqcm8f4uns4c\",\n add_debug_overlay: 0.0,\n auto_adjust_quality: 0.0,\n)\n \nres = s.video.start_universal_transcode(req)\n\nif res.status_code == 200\n # handle response\nend"
- label: startUniversalTranscode
lang: go
source: |-
package main
import(
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"context"
"log"
)
func main() {
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
plexgo.WithXPlexClientIdentifier("Postman"),
)
request := operations.StartUniversalTranscodeRequest{
HasMDE: 1,
Path: "/library/metadata/23409",
MediaIndex: 0,
PartIndex: 0,
Protocol: "hls",
FastSeek: plexgo.Float64(0),
DirectPlay: plexgo.Float64(0),
DirectStream: plexgo.Float64(0),
SubtitleSize: plexgo.Float64(100),
Subtites: plexgo.String("burn"),
AudioBoost: plexgo.Float64(100),
Location: plexgo.String("lan"),
MediaBufferSize: plexgo.Float64(102400),
Session: plexgo.String("zvcage8b7rkioqcm8f4uns4c"),
AddDebugOverlay: plexgo.Float64(0),
AutoAdjustQuality: plexgo.Float64(0),
}
ctx := context.Background()
res, err := s.Video.StartUniversalTranscode(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- label: startUniversalTranscode
lang: java
source: |-
package hello.world;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.Optional;
import lukehagar.plexapi.plexapi.PlexAPI;
import lukehagar.plexapi.plexapi.models.operations.*;
import lukehagar.plexapi.plexapi.models.shared.*;
import lukehagar.plexapi.plexapi.models.shared.Security;
import lukehagar.plexapi.plexapi.utils.EventStream;
import org.openapitools.jackson.nullable.JsonNullable;
import static java.util.Map.entry;
public class Application {
public static void main(String[] args) throws Exception {
try {
PlexAPI sdk = PlexAPI.builder()
.accessToken("<YOUR_API_KEY_HERE>")
.xPlexClientIdentifier("Postman")
.build();
StartUniversalTranscodeRequest req = StartUniversalTranscodeRequest.builder()
.hasMDE(1d)
.path("/library/metadata/23409")
.mediaIndex(0d)
.partIndex(0d)
.protocol("hls")
.fastSeek(0d)
.directPlay(0d)
.directStream(0d)
.subtitleSize(100d)
.subtites("burn")
.audioBoost(100d)
.location("lan")
.mediaBufferSize(102400d)
.session("zvcage8b7rkioqcm8f4uns4c")
.addDebugOverlay(0d)
.autoAdjustQuality(0d)
.build();
StartUniversalTranscodeResponse res = sdk.video().startUniversalTranscode()
.request(req)
.call();
// handle response
} catch (lukehagar.plexapi.plexapi.models.errors.StartUniversalTranscodeResponseBody e) {
// handle exception
throw e;
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
// handle exception
throw e;
} catch (Exception e) {
// handle exception
throw e;
}
}
}
- label: startUniversalTranscode
lang: typescript
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "Postman",
});
async function run() {
const result = await plexAPI.video.startUniversalTranscode({
hasMDE: 1,
path: "/library/metadata/23409",
mediaIndex: 0,
partIndex: 0,
protocol: "hls",
fastSeek: 0,
directPlay: 0,
directStream: 0,
subtitleSize: 100,
subtites: "burn",
audioBoost: 100,
location: "lan",
mediaBufferSize: 102400,
session: "zvcage8b7rkioqcm8f4uns4c",
addDebugOverlay: 0,
autoAdjustQuality: 0,
});
// Handle the result
console.log(result)
}
run();
security:
- accessToken: []
servers:
- description: The full address of your Plex Server
url: '{protocol}://{ip}:{port}'
variables:
ip:
default: 10.10.10.47
port:
default: "32400"
protocol:
default: http
enum:
- http
- https
tags:
- description: |
Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.
Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.
Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:
- They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.
- They must contain an `type` which is used by clients to distinguish the specific activity.
- They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)
- The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
name: Activities
- description: |
API Calls regarding authentication for Plex Media Server
name: Authentication
- description: |
Butler is the task manager of the Plex Media Server Ecosystem.
name: Butler
- description: |
Operations against the Plex Media Server System.
name: Server
- description: |
This describes the API for searching and applying updates to the Plex Media Server.
Updates to the status can be observed via the Event API.
name: Updater
- description: |
Submit logs to the Log Handler for Plex Media Server
name: Log
- description: |
API Calls interacting with Plex Media Server Libraries
name: Library
- description: |
API Calls interacting with Plex Media Server Media
name: Media
- description: |
Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
name: Hubs
- description: "Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as \"all albums from 2017\"). \nThey can be organized in (optionally nesting) folders.\nRetrieving a playlist, or its items, will trigger a refresh of its metadata. \nThis may cause the duration and number of items to change.\n"
name: Playlists
- description: |
API Calls that perform search operations with Plex Media Server
name: Search
- description: |
API Calls that perform search operations with Plex Media Server Sessions
name: Sessions
- description: |
API Calls that perform operations with Plex Media Server Users
name: User
- description: |
API Calls that perform operations with Plex Media Server Videos
name: Video
- description: |
API Calls that perform operations directly against https://Plex.tv
name: Plex
- description: |
API Calls that perform operations with Plex Media Server Statistics
name: Statistics
- description: |
API Calls that perform operations with Plex Media Server Watchlists
name: Watchlist
x-speakeasy-globals:
parameters:
- description: |
The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
in: header
name: X-Plex-Client-Identifier
required: true
schema:
example: Postman
type: string