openapi: 3.1.1
info:
title: Plex Media Server
version: 1.1.1
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: "https://{IP-description}.{identifier}.plex.direct:{port}"
variables:
identifier:
description: The unique identifier of this particular PMS
default: 0123456789abcdef0123456789abcdef
IP-description:
description: A `-` separated string of the IPv4 or IPv6 address components
default: 1-2-3-4
port:
default: '32400'
- url: "{protocol}://{host}:{port}"
variables:
protocol:
description: The network protocol to use. Typically (`http` or `https`)
default: http
host:
description: "The Host of the PMS.\nIf using on a local network, this is the internal IP address of the server hosting the PMS.\nIf using on an external network, this is the external IP address for your network, and requires port forwarding.\nIf using a reverse proxy, this would be the external DNS domain for your network, and requires the proxy handle port forwarding. \n"
default: localhost
port:
description: "The Port number configured on the PMS. Typically (`32400`). \nIf using a reverse proxy, this would be the port number configured on the proxy.\n"
default: '32400'
- url: "{full_server_url}"
variables:
full_server_url:
description: The full manual URL to access the PMS
default: http://localhost:32400
security:
- token:
- shared user
- admin
x-speakeasy-globals:
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
tags:
- name: Activities
description: |
Activities 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.
- name: Butler
description: The butler is responsible for running periodic tasks. Some tasks run daily, others every few days, and some weekly. These includes database maintenance, metadata updating, thumbnail generation, media analysis, and other tasks.
- name: Collections
description: API Operations against the Collections
- name: Content
description: The actual content of the media provider
- name: Devices
description: |
Media grabbers provide ways for media to be obtained for a given protocol. The simplest ones are `stream` and `download`. More complex grabbers can have associated devices
Network tuners can present themselves on the network using the Simple Service Discovery Protocol and Plex Media Server will discover them. The following XML is an example of the data returned from SSDP. The `deviceType`, `serviceType`, and `serviceId` values must remain as they are in the example in order for PMS to properly discover the device. Other less-obvious fields are described in the parameters section below.
Example SSDP output
```
1
0
urn:plex-tv:device:Media:1
Turing Hopper 3000
Plex, Inc.
https://plex.tv/
Turing Hopper 3000 Media Grabber
Plex Media Grabber
1
https://plex.tv
uuid:42fde8e4-93b6-41e5-8a63-12d848655811
http://10.0.0.5:8088
urn:plex-tv:service:MediaGrabber:1
urn:plex-tv:serviceId:MediaGrabber
```
- UDN: (string) A UUID for the device. This should be unique across models of a device at minimum.
- URLBase: (string) The base HTTP URL for the device from which all of the other endpoints are hosted.
- name: Download Queue
description: API Operations against the Download Queue
- name: DVRs
description: |
The DVR provides means to watch and record live TV. This section of endpoints describes how to setup the DVR itself
- name: EPG
description: |
The EPG (Electronic Program Guide) is responsible for obtaining metadata for what is airing on each channel and when
- name: Events
description: |
The server can notify clients in real-time of a wide range of events, from library scanning, to preferences being modified, to changes to media, and many other things. This is also the mechanism by which activity progress is reported.
Two protocols for receiving the events are available: EventSource (also known as SSE), and WebSocket.
- name: General
description: General endpoints for basic PMS operation not specific to any media provider
- name: Hubs
description: The hubs within a media provider
- name: Library
description: Library endpoints which are outside of the Media Provider API. Typically this is manipulation of the library (adding/removing sections, modifying preferences, etc).
- name: Library Collections
description: Endpoints for manipulating collections. In addition to these endpoints, `/library/collections/:collectionId/X` will be rerouted to `/library/metadata/:collectionId/X` and respond to those endpoints as well.
x-displayName: 'Library: Collections'
- name: Library Playlists
description: Endpoints for manipulating playlists.
x-displayName: 'Library: Playlists'
- name: Live TV
description: |
LiveTV contains the playback sessions of a channel from a DVR device
- name: Log
description: Logging mechanism to allow clients to log to the server
- name: Play Queue
description: "The playqueue feature within a media provider\nA play queue represents the current list of media for playback. Although queues are persisted by the server, they should be regarded by the user as a fairly lightweight, an ephemeral list of items queued up for playback in a session. There is generally one active queue for each type of media (music, video, photos) that can be added to or destroyed and replaced with a fresh queue.\nPlay Queues has a region, which we refer to in this doc (partially for historical reasons) as \"Up Next\". This region is defined by `playQueueLastAddedItemID` existing on the media container. This follows iTunes' terminology. It is a special region after the currently playing item but before the originally-played items. This enables \"Party Mode\" listening/viewing, where items can be added on-the-fly, and normal queue playback resumed when completed. \nYou can visualize the play queue as a sliding window in the complete list of media queued for playback. This model is important when scaling to larger play queues (e.g. shuffling 40,000 audio tracks). The client only needs visibility into small areas of the queue at any given time, and the server can optimize access in this fashion.\nAll created play queues will have an empty \"Up Next\" area - unless the item is an album and no `key` is provided. In this case the \"Up Next\" area will be populated by the contents of the album. This is to allow queueing of multiple albums - since the 'Add to Up Next' will insert after all the tracks. This means that If you're creating a PQ from an album, you can only shuffle it if you set `key`. This is due to the above implicit queueing of albums when no `key` is provided as well as the current limitation that you cannot shuffle a PQ with an \"Up Next\" area.\nThe play queue window advances as the server receives timeline requests. The client needs to retrieve the play queue as the “now playing” item changes. There is no play queue API to update the playing item."
- name: Playlist
description: Media playlists that can be created and played back
- name: Preferences
description: API Operations against the Preferences
- name: Provider
description: Media providers are the starting points for the entire Plex Media Server media library API. It defines the paths for the groups of endpoints. The `/media/providers` should be the only hard-coded path in clients when accessing the media library. Non-media library endpoints are outside the scope of the media provider. See the description in See [the section in API Info](#section/API-Info/Media-Providers) for more information on how to use media providers.
- name: Rate
description: Operations for rating media items (thumbs up/down, star ratings, etc.)
- name: Search
description: The search feature within a media provider
- name: Status
description: The status endpoints give you information about current playbacks, play history, and even terminating sessions.
- name: Subscriptions
description: |
Subscriptions determine which media will be recorded and the criteria for selecting an airing when multiple are available
- name: Timeline
description: The actions feature within a media provider
- name: Transcoder
description: API Operations against the Transcoder
- name: UltraBlur
description: Service provided to compute UltraBlur colors and images.
- name: Updater
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.
x-tagGroups:
- name: General
tags:
- General
- Library
- Library Playlists
- Library Collections
- Status
- Activities
- Updater
- Butler
- Events
- Log
- Preferences
- Download Queue
- UltraBlur
- Transcoder
- name: Playback & Sessions
tags:
- Status
- Timeline
- Play Queue
- Transcoder
- name: Media Provider
tags:
- Provider
- Content
- Hubs
- Search
- Rate
- Playlist
- Play Queue
- Timeline
- name: DVR
tags:
- DVRs
- Devices
- EPG
- Subscriptions
- Live TV
paths:
/:
get:
summary: Get PMS info
operationId: getServerInfo
description: Information about this PMS setup and configuration
tags:
- General
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithDirectory'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->server->getServerCapabilities(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.server.get_server_capabilities()
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.General.GetServerInfo(ctx, operations.GetServerInfoRequest{})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithDirectory != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetServerInfoRequest;
import dev.plexapi.sdk.models.operations.GetServerInfoResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetServerInfoRequest req = GetServerInfoRequest.builder()
.build();
GetServerInfoResponse res = sdk.general().getServerInfo()
.request(req)
.call();
if (res.mediaContainerWithDirectory().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.general.getServerInfo({});
console.log(result);
}
run();
/:/eventsource/notifications:
get:
summary: Connect to Eventsource
operationId: getNotifications
description: Connect to the event source to get a stream of events
tags:
- Events
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: filter
description: |
By default, all events except logs are sent. A rich filtering mechanism is provided to allow clients to opt into or out of each event type using the `filters` parameter. For example:
- `filters=-log`: All event types except logs (the default).
- `filters=foo,bar`: Only the foo and bar event types.
- `filters=`: All events types.
- `filters=-foo,bar`: All event types except foo and bar.
in: query
schema:
type: array
items:
type: string
responses:
'200':
description: OK
content:
application/octet-stream:
schema:
format: binary
type: string
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Events.GetNotifications(ctx, operations.GetNotificationsRequest{})
if err != nil {
log.Fatal(err)
}
if res.ResponseStream != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetNotificationsRequest;
import dev.plexapi.sdk.models.operations.GetNotificationsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetNotificationsRequest req = GetNotificationsRequest.builder()
.build();
GetNotificationsResponse res = sdk.events().getNotifications()
.request(req)
.call();
if (res.responseStream().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.events.getNotifications({});
console.log(result);
}
run();
/:/prefs:
get:
summary: Get all preferences
operationId: getAllPreferences
description: Get the list of all preferences
tags:
- Preferences
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithSettings'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->server->getServerPreferences(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.server.get_server_preferences()
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Preferences.GetAllPreferences(ctx)
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithSettings != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetAllPreferencesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetAllPreferencesResponse res = sdk.preferences().getAllPreferences()
.call();
if (res.mediaContainerWithSettings().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.preferences.getAllPreferences();
console.log(result);
}
run();
put:
summary: Set preferences
operationId: setPreferences
description: Set a set of preferences in query parameters
tags:
- Preferences
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: prefs
in: query
required: true
schema:
type: object
example:
FriendlyName: My Server
ScheduledLibraryUpdateInterval: 3600
sendCrashReports: 1
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: Attempt to set a preferences that doesn't exist
content:
text/html: {}
'403':
description: Attempt to set a preferences that doesn't exist
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Preferences.SetPreferences(ctx, operations.SetPreferencesRequest{
Prefs: operations.Prefs{},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
SetPreferencesRequest req = SetPreferencesRequest.builder()
.prefs(Prefs.builder()
.build())
.build();
SetPreferencesResponse res = sdk.preferences().setPreferences()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.preferences.setPreferences({
prefs: {},
});
console.log(result);
}
run();
/:/prefs/get:
get:
summary: Get a preferences
operationId: getPreference
description: Get a single preference and value
tags:
- Preferences
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: id
description: The preference to fetch
in: query
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithSettings'
'404':
description: No preference with the provided name found.
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Preferences.GetPreference(ctx, operations.GetPreferenceRequest{})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithSettings != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetPreferenceRequest;
import dev.plexapi.sdk.models.operations.GetPreferenceResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetPreferenceRequest req = GetPreferenceRequest.builder()
.build();
GetPreferenceResponse res = sdk.preferences().getPreference()
.request(req)
.call();
if (res.mediaContainerWithSettings().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.preferences.getPreference({});
console.log(result);
}
run();
/:/rate:
put:
summary: Rate an item
operationId: setRating
description: |-
Set the rating on an item.
This API does respond to the GET verb but applications should use PUT
tags:
- Rate
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: identifier
description: The identifier of the media provider containing the media to rate. Typically `com.plexapp.plugins.library`
in: query
required: true
schema:
type: string
- name: key
description: The key of the item to rate. This is the `ratingKey` found in metadata items
in: query
required: true
schema:
type: string
- name: rating
description: The rating to give the item.
in: query
required: true
schema:
maximum: 10
minimum: 0
type: number
- name: ratedAt
description: The time when the rating occurred. If not present, interpreted as now.
in: query
required: false
schema:
type: integer
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: Bad Request. Can occur when parameters are of the wrong type, missing, or if the `ratedAt` is in the future
content:
text/html: {}
'404':
description: Indicates that no library with the provide identifier can be found or no item can be found with the rating key
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Rate.SetRating(ctx, operations.SetRatingRequest{
Identifier: "",
Key: "",
Rating: 8722.46,
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.SetRatingRequest;
import dev.plexapi.sdk.models.operations.SetRatingResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
SetRatingRequest req = SetRatingRequest.builder()
.identifier("")
.key("")
.rating(8722.46)
.build();
SetRatingResponse res = sdk.rate().setRating()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.rate.setRating({
identifier: "",
key: "",
rating: 8722.46,
});
console.log(result);
}
run();
/:/scrobble:
put:
summary: Mark an item as played
operationId: markPlayed
description: |-
Mark an item as played. Note, this does not create any view history of this item but rather just sets the state as played. The client must provide either the `key` or `uri` query parameter
This API does respond to the GET verb but applications should use PUT
tags:
- Timeline
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: identifier
description: The identifier of the media provider containing the media to rate. Typically `com.plexapp.plugins.library`
in: query
required: true
schema:
type: string
- name: key
description: The key of the item to rate. This is the `ratingKey` found in metadata items
in: query
required: false
schema:
type: string
- name: uri
description: The URI of the item to mark as played. See intro for description of the URIs
in: query
required: false
schema:
type: string
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: Bad Request. Can occur when parameters are of the wrong type, or missing
content:
text/html: {}
'404':
description: Indicates that no library with the provide identifier can be found or no item can be found with the rating key
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Timeline.MarkPlayed(ctx, operations.MarkPlayedRequest{
Identifier: "",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.MarkPlayedRequest;
import dev.plexapi.sdk.models.operations.MarkPlayedResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
MarkPlayedRequest req = MarkPlayedRequest.builder()
.identifier("")
.build();
MarkPlayedResponse res = sdk.timeline().markPlayed()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.timeline.markPlayed({
identifier: "",
});
console.log(result);
}
run();
/:/timeline:
post:
summary: Report media timeline
operationId: report
description: |
This endpoint is hit during media playback for an item. It must be hit whenever the play state changes, or in the absence of a play state change, in a regular fashion (generally this means every 10 seconds on a LAN/WAN, and every 20 seconds over cellular).
tags:
- Timeline
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: key
description: The details key for the item.
in: query
schema:
type: string
example: /foo
- name: ratingKey
description: The rating key attribute for the item.
in: query
schema:
type: string
example: xyz
- name: state
description: The current state of the media.
in: query
schema:
type: string
enum:
- stopped
- buffering
- playing
- paused
example: playing
- name: playQueueItemID
description: If playing media from a play queue, the play queue's ID.
in: query
schema:
type: string
example: 123
- name: time
description: The current time offset of playback in ms.
in: query
schema:
type: integer
example: 0
- name: duration
description: The total duration of the item in ms.
in: query
schema:
type: integer
example: 10000
- name: continuing
description: When state is `stopped`, a flag indicating whether or not the client is going to continue playing anothe item.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: updated
description: Used when a sync client comes online and is syncing media timelines, holds the time at which the playback state was last updated.
in: query
schema:
type: integer
example: 14200000
- name: offline
description: Also used by sync clients, used to indicate that a timeline is being synced from being offline, as opposed to being "live".
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: timeToFirstFrame
description: Time in seconds till first frame is displayed. Sent only on the first playing timeline request.
in: query
schema:
type: integer
example: 1000
- name: timeStalled
description: Time in seconds spent buffering since last request.
in: query
schema:
type: integer
example: 1000
- name: bandwidth
description: Bandwidth in kbps as estimated by the client.
in: query
schema:
type: integer
example: 100
- name: bufferedTime
description: Amount of time in seconds buffered by client. Omit if computed by `bufferedSize` below.
in: query
schema:
type: integer
example: 100
- name: bufferedSize
description: Size in kilobytes of data buffered by client. Omit if computed by `bufferedTime` above
in: query
schema:
type: integer
example: 1024
- name: X-Plex-Client-Identifier
description: Unique per client.
in: header
required: true
schema:
type: string
- name: X-Plex-Session-Identifier
description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)
in: header
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/ServerConfiguration'
- properties:
Bandwidths:
description: A list of media times and bandwidths when trascoding is using with auto adjustment of bandwidth
properties:
Bandwidth:
items:
properties:
bandwidth:
description: The bandwidth at this time in kbps
type: integer
resolution:
description: The user-friendly resolution at this time
type: string
time:
description: Media playback time where this bandwidth started
type: integer
type: object
type: array
type: object
terminationCode:
description: A code describing why the session was terminated by the server.
type: integer
terminationText:
description: A user friendly and localized text describing why the session was terminated by the server.
type: string
type: object
type: object
'400':
$ref: '#/components/responses/400'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Timeline.Report(ctx, operations.ReportRequest{
Key: plexgo.Pointer("/foo"),
RatingKey: plexgo.Pointer("xyz"),
State: operations.StatePlaying.ToPointer(),
PlayQueueItemID: plexgo.Pointer("123"),
Time: plexgo.Pointer[int64](0),
Duration: plexgo.Pointer[int64](10000),
Continuing: components.BoolIntOne.ToPointer(),
Updated: plexgo.Pointer[int64](14200000),
Offline: components.BoolIntOne.ToPointer(),
TimeToFirstFrame: plexgo.Pointer[int64](1000),
TimeStalled: plexgo.Pointer[int64](1000),
Bandwidth: plexgo.Pointer[int64](100),
BufferedTime: plexgo.Pointer[int64](100),
BufferedSize: plexgo.Pointer[int64](1024),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ReportRequest req = ReportRequest.builder()
.key("/foo")
.ratingKey("xyz")
.state(State.PLAYING)
.playQueueItemID("123")
.time(0L)
.duration(10000L)
.continuing(BoolInt.ONE)
.updated(14200000L)
.offline(BoolInt.ONE)
.timeToFirstFrame(1000L)
.timeStalled(1000L)
.bandwidth(100L)
.bufferedTime(100L)
.bufferedSize(1024L)
.build();
ReportResponse res = sdk.timeline().report()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { ReportState } from "@lukehagar/plexjs/sdk/models/operations";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.timeline.report({
key: "/foo",
ratingKey: "xyz",
state: ReportState.Playing,
playQueueItemID: "123",
time: 0,
duration: 10000,
continuing: BoolInt.One,
updated: 14200000,
offline: BoolInt.One,
timeToFirstFrame: 1000,
timeStalled: 1000,
bandwidth: 100,
bufferedTime: 100,
bufferedSize: 1024,
});
console.log(result);
}
run();
/:/unscrobble:
put:
summary: Mark an item as unplayed
operationId: unscrobble
description: |-
Mark an item as unplayed. The client must provide either the `key` or `uri` query parameter
This API does respond to the GET verb but applications should use PUT
tags:
- Timeline
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: identifier
description: The identifier of the media provider containing the media to rate. Typically `com.plexapp.plugins.library`
in: query
required: true
schema:
type: string
- name: key
description: The key of the item to rate. This is the `ratingKey` found in metadata items
in: query
required: false
schema:
type: string
- name: uri
description: The URI of the item to mark as played. See intro for description of the URIs
in: query
required: false
schema:
type: string
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: Bad Request. Can occur when parameters are of the wrong type, or missing
content:
text/html: {}
'404':
description: Indicates that no library with the provide identifier can be found or no item can be found with the rating key
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Timeline.Unscrobble(ctx, operations.UnscrobbleRequest{
Identifier: "",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.UnscrobbleRequest;
import dev.plexapi.sdk.models.operations.UnscrobbleResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
UnscrobbleRequest req = UnscrobbleRequest.builder()
.identifier("")
.build();
UnscrobbleResponse res = sdk.timeline().unscrobble()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.timeline.unscrobble({
identifier: "",
});
console.log(result);
}
run();
/:/websocket/notifications:
get:
summary: Connect to WebSocket
operationId: connectWebSocket
description: Connect to the web socket to get a stream of events
tags:
- Events
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: filter
description: |
By default, all events except logs are sent. A rich filtering mechanism is provided to allow clients to opt into or out of each event type using the `filters` parameter. For example:
- `filters=-log`: All event types except logs (the default).
- `filters=foo,bar`: Only the foo and bar event types.
- `filters=`: All events types.
- `filters=-foo,bar`: All event types except foo and bar.
in: query
schema:
type: array
items:
type: string
responses:
'200':
description: OK
content:
application/octet-stream:
schema:
format: binary
type: string
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Events.ConnectWebSocket(ctx, operations.ConnectWebSocketRequest{})
if err != nil {
log.Fatal(err)
}
if res.ResponseStream != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ConnectWebSocketRequest;
import dev.plexapi.sdk.models.operations.ConnectWebSocketResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ConnectWebSocketRequest req = ConnectWebSocketRequest.builder()
.build();
ConnectWebSocketResponse res = sdk.events().connectWebSocket()
.request(req)
.call();
if (res.responseStream().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.events.connectWebSocket({});
console.log(result);
}
run();
/activities:
get:
summary: Get all activities
operationId: listActivities
description: List all activities on the server. Admins can see all activities but other users can only see their own
tags:
- Activities
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- properties:
Activity:
items:
properties:
cancellable:
description: Indicates whether this activity can be cancelled
type: boolean
Context:
description: An object with additional values
additionalProperties: true
type: object
progress:
description: A progress percentage. A value of -1 means the progress is indeterminate
maximum: 100
minimum: -1
type: number
Response:
description: An object with the response to the async opperation
additionalProperties: true
type: object
subtitle:
description: A user-friendly sub-title for this activity
type: string
title:
description: A user-friendly title for this activity
type: string
type:
description: The type of activity
type: string
userID:
description: The user this activity belongs to
type: integer
uuid:
description: The ID of the activity
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->activities->getServerActivities(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.activities.get_server_activities()
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Activities.ListActivities(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListActivitiesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListActivitiesResponse res = sdk.activities().listActivities()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.activities.listActivities();
console.log(result);
}
run();
/butler:
delete:
summary: Stop all Butler tasks
operationId: stopTasks
description: This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
tags:
- Butler
security:
- token:
- admin
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->butler->stopAllTasks(
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.butler.stop_all_tasks()
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Butler.StopTasks(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.StopTasksResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
StopTasksResponse res = sdk.butler().stopTasks()
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.butler.stopTasks();
console.log(result);
}
run();
get:
summary: Get all Butler tasks
operationId: getTasks
description: |
Get the list of butler tasks and their scheduling
tags:
- Butler
security:
- token:
- admin
responses:
'200':
description: Butler tasks
content:
application/json:
schema:
properties:
ButlerTasks:
properties:
ButlerTask:
items:
properties:
description:
description: A user-friendly description of the task
type: string
enabled:
description: Whether this task is enabled or not
type: boolean
interval:
description: The interval (in days) of when this task is run. A value of 1 is run every day, 7 is every week, etc.
type: integer
name:
description: The name of the task
type: string
scheduleRandomized:
description: Indicates whether the timing of the task is randomized within the butler interval
type: boolean
title:
description: A user-friendly title of the task
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->butler->getButlerTasks(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.butler.get_butler_tasks()
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Butler.GetTasks(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetTasksResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetTasksResponse res = sdk.butler().getTasks()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.butler.getTasks();
console.log(result);
}
run();
post:
summary: Start all Butler tasks
operationId: startTasks
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.
tags:
- Butler
security:
- token:
- admin
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->butler->startAllTasks(
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.butler.start_all_tasks()
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Butler.StartTasks(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.StartTasksResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
StartTasksResponse res = sdk.butler().startTasks()
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.butler.startTasks();
console.log(result);
}
run();
/downloadQueue:
post:
summary: Create download queue
operationId: createDownloadQueue
description: |
Available: 0.2.0
Creates a download queue for this client if one doesn't exist, or returns the existing queue for this client and user.
tags:
- Download Queue
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
DownloadQueue:
items:
properties:
id:
type: integer
itemCount:
type: integer
status:
description: |
The state of this queue
- deciding: At least one item is still being decided
- waiting: At least one item is waiting for transcode and none are currently transcoding
- processing: At least one item is being transcoded
- done: All items are available (or potentially expired)
- error: At least one item has encountered an error
enum:
- deciding
- waiting
- processing
- done
- error
type: string
type: object
type: array
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.DownloadQueue.CreateDownloadQueue(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CreateDownloadQueueResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CreateDownloadQueueResponse res = sdk.downloadQueue().createDownloadQueue()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.downloadQueue.createDownloadQueue();
console.log(result);
}
run();
/hubs:
get:
summary: Get global hubs
operationId: getAllHubs
description: Get the global hubs in this PMS
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/count'
- name: onlyTransient
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
schema:
$ref: "#/components/schemas/BoolInt"
- name: identifier
description: If provided, limit to only specified hubs
in: query
schema:
type: array
items:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
$ref: '#/components/headers/X-Plex-Container-Start'
X-Plex-Container-Total-Size:
$ref: '#/components/headers/X-Plex-Container-Total-Size'
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Hub:
items:
$ref: '#/components/schemas/Hub'
type: array
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->hubs->getGlobalHubs(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.hubs.get_global_hubs(count=1262.49, only_transient=Models::Operations::OnlyTransient::ONE)
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetAllHubs(ctx, operations.GetAllHubsRequest{
OnlyTransient: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetAllHubsRequest;
import dev.plexapi.sdk.models.operations.GetAllHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetAllHubsRequest req = GetAllHubsRequest.builder()
.onlyTransient(BoolInt.ONE)
.build();
GetAllHubsResponse res = sdk.hubs().getAllHubs()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getAllHubs({
onlyTransient: BoolInt.One,
});
console.log(result);
}
run();
/hubs/continueWatching:
get:
summary: Get the continue watching hub
operationId: getContinueWatching
description: Get the global continue watching hub
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/count'
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
$ref: '#/components/headers/X-Plex-Container-Start'
X-Plex-Container-Total-Size:
$ref: '#/components/headers/X-Plex-Container-Total-Size'
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Hub:
items:
$ref: '#/components/schemas/Hub'
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetContinueWatching(ctx, operations.GetContinueWatchingRequest{})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetContinueWatchingRequest;
import dev.plexapi.sdk.models.operations.GetContinueWatchingResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetContinueWatchingRequest req = GetContinueWatchingRequest.builder()
.build();
GetContinueWatchingResponse res = sdk.hubs().getContinueWatching()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getContinueWatching({});
console.log(result);
}
run();
/hubs/items:
get:
summary: Get a hub's items
operationId: getHubItems
description: Get the items within a single hub specified by identifier
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/count'
- name: identifier
description: If provided, limit to only specified hubs
in: query
required: true
schema:
type: array
items:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
$ref: '#/components/headers/X-Plex-Container-Start'
X-Plex-Container-Total-Size:
$ref: '#/components/headers/X-Plex-Container-Total-Size'
content:
application/json:
schema:
properties:
MediaContainer:
$ref: '#/components/schemas/MediaContainer'
type: object
'404':
description: The specified hub could not be found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetHubItems(ctx, operations.GetHubItemsRequest{
Identifier: []string{
"",
"",
"",
},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetHubItemsRequest;
import dev.plexapi.sdk.models.operations.GetHubItemsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetHubItemsRequest req = GetHubItemsRequest.builder()
.identifier(List.of(
"",
"",
""))
.build();
GetHubItemsResponse res = sdk.hubs().getHubItems()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getHubItems({
identifier: [
"",
"",
"",
],
});
console.log(result);
}
run();
/hubs/promoted:
get:
summary: Get the hubs which are promoted
operationId: getPromotedHubs
description: Get the global hubs which are promoted (should be displayed on the home screen)
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/count'
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
$ref: '#/components/headers/X-Plex-Container-Start'
X-Plex-Container-Total-Size:
$ref: '#/components/headers/X-Plex-Container-Total-Size'
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Hub:
items:
$ref: '#/components/schemas/Hub'
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetPromotedHubs(ctx, operations.GetPromotedHubsRequest{})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetPromotedHubsRequest;
import dev.plexapi.sdk.models.operations.GetPromotedHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetPromotedHubsRequest req = GetPromotedHubsRequest.builder()
.build();
GetPromotedHubsResponse res = sdk.hubs().getPromotedHubs()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getPromotedHubs({});
console.log(result);
}
run();
/hubs/search:
get:
summary: Search Hub
operationId: searchHubs
description: |
Perform a search and get the result as hubs
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).
- ``: 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.
tags:
- Search
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: query
description: The query term
in: query
required: true
schema:
type: string
- name: sectionId
description: This gives context to the search, and can result in re-ordering of search result hubs.
in: query
schema:
type: integer
example: 1
- name: limit
description: The number of items to return per hub. 3 if not specified
in: query
schema:
type: integer
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
$ref: '#/components/headers/X-Plex-Container-Start'
X-Plex-Container-Total-Size:
$ref: '#/components/headers/X-Plex-Container-Total-Size'
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Hub:
items:
$ref: '#/components/schemas/Hub'
type: array
type: object
type: object
'400':
description: A required parameter was not given, the wrong type, or wrong value
content:
text/html: {}
'404':
description: Search restrictions result in no possible items found (such as searching no sections)
content:
text/html: {}
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->search->performSearch(
query: 'arnold',
limit: 5
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.search.perform_search(query="dylan", section_id=9372.7, limit=5.0)
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Search.SearchHubs(ctx, operations.SearchHubsRequest{
Query: "",
SectionID: plexgo.Pointer[int64](1),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.SearchHubsRequest;
import dev.plexapi.sdk.models.operations.SearchHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
SearchHubsRequest req = SearchHubsRequest.builder()
.query("")
.sectionId(1L)
.build();
SearchHubsResponse res = sdk.search().searchHubs()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.search.searchHubs({
query: "",
sectionId: 1,
});
console.log(result);
}
run();
/hubs/search/voice:
get:
summary: Voice Search Hub
operationId: voiceSearchHubs
description: |
Perform a search tailored to voice input and get the result as hubs
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. It 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. Whenever possible, clients should limit the search to the appropriate type.
Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
tags:
- Search
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: query
description: The query term
in: query
required: true
schema:
type: string
- $ref: '#/components/parameters/type'
- name: limit
description: The number of items to return per hub. 3 if not specified
in: query
schema:
type: integer
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
$ref: '#/components/headers/X-Plex-Container-Start'
X-Plex-Container-Total-Size:
$ref: '#/components/headers/X-Plex-Container-Total-Size'
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Hub:
items:
$ref: '#/components/schemas/Hub'
type: array
type: object
type: object
'400':
description: A required parameter was not given, the wrong type, or wrong value
content:
text/html: {}
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->search->performVoiceSearch(
query: 'dead+poop',
limit: 5
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.search.perform_voice_search(query="dead+poop", section_id=4094.8, limit=5.0)
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Search.VoiceSearchHubs(ctx, operations.VoiceSearchHubsRequest{
Query: "",
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.VoiceSearchHubsRequest;
import dev.plexapi.sdk.models.operations.VoiceSearchHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
VoiceSearchHubsRequest req = VoiceSearchHubsRequest.builder()
.query("")
.build();
VoiceSearchHubsResponse res = sdk.search().voiceSearchHubs()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.search.voiceSearchHubs({
query: "",
});
console.log(result);
}
run();
/identity:
get:
summary: Get PMS identity
operationId: getIdentity
description: Get details about this PMS's identity
tags:
- General
security:
- {}
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
properties:
claimed:
description: Indicates whether this server has been claimed by a user
type: boolean
machineIdentifier:
description: A unique identifier of the computer
type: string
size:
type: integer
version:
description: The full version string of the PMS
type: string
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()->build();
$response = $sdk->server->getServerIdentity(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new
res = s.server.get_server_identity()
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New()
res, err := s.General.GetIdentity(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetIdentityResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.build();
GetIdentityResponse res = sdk.general().getIdentity()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.general.getIdentity();
console.log(result);
}
run();
/library/all:
get:
summary: Get all items in library
operationId: getLibraryItems
description: Request all metadata items according to a query.
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/mediaQuery'
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetLibraryItemsRequest;
import dev.plexapi.sdk.models.operations.GetLibraryItemsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetLibraryItemsRequest req = GetLibraryItemsRequest.builder()
.build();
GetLibraryItemsResponse res = sdk.library().getLibraryItems()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getLibraryItems({});
console.log(result);
}
run();
/library/caches:
delete:
summary: Delete library caches
operationId: deleteCaches
description: Delete the hub caches so they are recomputed on next request
tags:
- Library
security:
- token:
- admin
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Library.DeleteCaches(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.DeleteCachesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
DeleteCachesResponse res = sdk.library().deleteCaches()
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.library.deleteCaches();
console.log(result);
}
run();
/library/clean/bundles:
put:
summary: Clean bundles
operationId: cleanBundles
description: Clean out any now unused bundles. Bundles can become unused when media is deleted
tags:
- Library
security:
- token:
- admin
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Library.CleanBundles(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CleanBundlesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CleanBundlesResponse res = sdk.library().cleanBundles()
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.library.cleanBundles();
console.log(result);
}
run();
/library/collections:
post:
summary: Create collection
operationId: createCollection
description: Create a collection in the library
tags:
- Collections
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sectionId
description: The section where this collection will be created
in: query
required: true
schema:
type: string
- $ref: '#/components/parameters/title'
- $ref: '#/components/parameters/smart'
- name: uri
description: The URI for processing the smart collection. Required for a smart collection
in: query
schema:
type: string
- $ref: '#/components/parameters/type'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
'400':
description: The uri is missing for a smart collection or the section could not be found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Collections.CreateCollection(ctx, operations.CreateCollectionRequest{
SectionID: "",
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CreateCollectionRequest;
import dev.plexapi.sdk.models.operations.CreateCollectionResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CreateCollectionRequest req = CreateCollectionRequest.builder()
.sectionId("")
.build();
CreateCollectionResponse res = sdk.collections().createCollection()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.collections.createCollection({
sectionId: "",
});
console.log(result);
}
run();
/library/file:
post:
summary: Ingest a transient item
operationId: ingestTransientItem
description: |-
This endpoint takes a file path specified in the `url` parameter, matches it using the scanner's match mechanism, downloads rich metadata, and then ingests the item as a transient item (without a library section). In the case where the file represents an episode, the entire tree (show, season, and episode) is added as transient items. At this time, movies and episodes are the only supported types, which are gleaned automatically from the file path.
Note that any of the parameters passed to the metadata details endpoint (e.g. `includeExtras=1`) work here.
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: url
description: The file of the file to ingest.
in: query
schema:
type: string
format: url
example: file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv
- name: virtualFilePath
description: A virtual path to use when the url is opaque.
in: query
schema:
type: string
example: /Avatar.mkv
- name: computeHashes
description: Whether or not to compute Plex and OpenSubtitle hashes for the file. Defaults to 0.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: ingestNonMatches
description: Whether or not non matching media should be stored. Defaults to 0.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.IngestTransientItem(ctx, operations.IngestTransientItemRequest{
URL: plexgo.Pointer("file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv"),
VirtualFilePath: plexgo.Pointer("/Avatar.mkv"),
ComputeHashes: components.BoolIntOne.ToPointer(),
IngestNonMatches: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.IngestTransientItemRequest;
import dev.plexapi.sdk.models.operations.IngestTransientItemResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
IngestTransientItemRequest req = IngestTransientItemRequest.builder()
.url("file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv")
.virtualFilePath("/Avatar.mkv")
.computeHashes(BoolInt.ONE)
.ingestNonMatches(BoolInt.ONE)
.build();
IngestTransientItemResponse res = sdk.library().ingestTransientItem()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.ingestTransientItem({
url: "file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv",
virtualFilePath: "/Avatar.mkv",
computeHashes: BoolInt.One,
ingestNonMatches: BoolInt.One,
});
console.log(result);
}
run();
/library/matches:
get:
summary: Get library matches
operationId: getLibraryMatches
description: |-
The matches endpoint is used to match content external to the library with content inside the library. This is done by passing a series of semantic "hints" about the content (its type, name, or release year). Each type (e.g. movie) has a canonical set of minimal required hints.
This ability to match content is useful in a variety of scenarios. For example, in the DVR, the EPG uses the endpoint to match recording rules against airing content. And in the cloud, the UMP uses the endpoint to match up a piece of media with rich metadata.
The endpoint response can including multiple matches, if there is ambiguity, each one containing a `score` from 0 to 100. For somewhat historical reasons, anything over 85 is considered a positive match (we prefer false negatives over false positives in general for matching).
The `guid` hint is somewhat special, in that it generally represents a unique identity for a piece of media (e.g. the IMDB `ttXXX`) identifier, in contrast with other hints which can be much more ambiguous (e.g. a title of `Jane Eyre`, which could refer to the 1943 or the 2011 version).
Episodes require either a season/episode pair, or an air date (or both). Either the path must be sent, or the show title
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/type'
- name: includeFullMetadata
in: query
schema:
description: Whether or not to include full metadata on a positive match. When set, and the best match exceeds a score threshold of 85, metadata as rich as possible is sent back.
$ref: "#/components/schemas/BoolInt"
- name: includeAncestorMetadata
in: query
schema:
description: Whether or not to include metadata for the item's ancestor (e.g. show and season data for an episode).
$ref: "#/components/schemas/BoolInt"
- name: includeAlternateMetadataSources
in: query
schema:
description: Whether or not to return all sources for each metadata field, which results in a different structure being passed back.
$ref: "#/components/schemas/BoolInt"
- name: guid
description: Used for movies, shows, artists, albums, and tracks. Allowed for various URI schemes, to be defined.
in: query
schema:
type: string
- $ref: '#/components/parameters/title'
- name: year
description: Used for movies shows, and albums. Optional.
in: query
schema:
type: integer
- name: path
description: Used for movies, episodes, and tracks. The full path to the media file, used for "cloud-scanning" an item.
in: query
schema:
type: string
- name: grandparentTitle
description: Used for episodes and tracks. The title of the show/artist. Required if `path` isn't passed.
in: query
schema:
type: string
- name: grandparentYear
description: Used for episodes. The year of the show.
in: query
schema:
type: integer
- name: parentIndex
description: Used for episodes and tracks. The season/album number.
in: query
schema:
type: integer
- name: index
description: Used for episodes and tracks. The episode/tracks number in the season/album.
in: query
schema:
type: integer
- name: originallyAvailableAt
description: Used for episodes. In the format `YYYY-MM-DD`.
in: query
schema:
type: string
- name: parentTitle
description: Used for albums and tracks. The artist name for albums or the album name for tracks.
in: query
schema:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetLibraryMatches(ctx, operations.GetLibraryMatchesRequest{
IncludeFullMetadata: components.BoolIntOne.ToPointer(),
IncludeAncestorMetadata: components.BoolIntOne.ToPointer(),
IncludeAlternateMetadataSources: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetLibraryMatchesRequest;
import dev.plexapi.sdk.models.operations.GetLibraryMatchesResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetLibraryMatchesRequest req = GetLibraryMatchesRequest.builder()
.includeFullMetadata(BoolInt.ONE)
.includeAncestorMetadata(BoolInt.ONE)
.includeAlternateMetadataSources(BoolInt.ONE)
.build();
GetLibraryMatchesResponse res = sdk.library().getLibraryMatches()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getLibraryMatches({
includeFullMetadata: BoolInt.One,
includeAncestorMetadata: BoolInt.One,
includeAlternateMetadataSources: BoolInt.One,
});
console.log(result);
}
run();
/library/optimize:
put:
summary: Optimize the Database
operationId: optimizeDatabase
description: Initiate optimize on the database.
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: async
description: If set, don't wait for completion but return an activity
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.OptimizeDatabase(ctx, operations.OptimizeDatabaseRequest{
Async: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.OptimizeDatabaseRequest;
import dev.plexapi.sdk.models.operations.OptimizeDatabaseResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
OptimizeDatabaseRequest req = OptimizeDatabaseRequest.builder()
.async(BoolInt.ONE)
.build();
OptimizeDatabaseResponse res = sdk.library().optimizeDatabase()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.optimizeDatabase({
async: BoolInt.One,
});
console.log(result);
}
run();
/library/randomArtwork:
get:
summary: Get random artwork
operationId: getRandomArtwork
description: |
Get random artwork across sections. This is commonly used for a screensaver.
This retrieves 100 random artwork paths in the specified sections and returns them. Restrictions are put in place to not return artwork for items the user is not allowed to access. Artwork will be for Movies, Shows, and Artists only.
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sections
description: The sections for which to fetch artwork.
in: query
explode: false
schema:
type: array
items:
type: integer
example:
- 5
- 6
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithArtwork'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetRandomArtwork(ctx, operations.GetRandomArtworkRequest{
Sections: []int64{
5,
6,
},
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithArtwork != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetRandomArtworkRequest;
import dev.plexapi.sdk.models.operations.GetRandomArtworkResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetRandomArtworkRequest req = GetRandomArtworkRequest.builder()
.sections(List.of(
5L,
6L))
.build();
GetRandomArtworkResponse res = sdk.library().getRandomArtwork()
.request(req)
.call();
if (res.mediaContainerWithArtwork().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getRandomArtwork({
sections: [
5,
6,
],
});
console.log(result);
}
run();
/library/sections/all:
get:
summary: Get library sections (main Media Provider Only)
operationId: getSections
description: |-
A library section (commonly referred to as just a library) is a collection of media. Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat.
Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year).
tags:
- Library
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
$ref: '#/components/headers/X-Plex-Container-Start'
X-Plex-Container-Total-Size:
$ref: '#/components/headers/X-Plex-Container-Total-Size'
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
allowSync:
$ref: '#/components/schemas/AllowSync'
Directory:
items:
$ref: '#/components/schemas/LibrarySection'
type: array
title1:
description: Typically just "Plex Library"
type: string
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Library.GetSections(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetSectionsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetSectionsResponse res = sdk.library().getSections()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.library.getSections();
console.log(result);
}
run();
post:
summary: Add a library section
operationId: addSection
description: Add a new library section to the server
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: name
description: The name of the new section
in: query
required: true
schema:
type: string
- name: type
description: The type of library section
in: query
required: true
schema:
type: integer
- name: scanner
description: The scanner this section should use
in: query
schema:
type: string
- name: agent
description: The agent this section should use for metadata
in: query
required: true
schema:
type: string
- name: metadataAgentProviderGroupId
description: The agent group id for this section
in: query
schema:
type: string
- name: language
description: The language of this section
in: query
required: true
schema:
type: string
- name: locations
description: The locations on disk to add to this section
in: query
schema:
type: array
items:
type: string
example:
- O:\fatboy\Media\Ripped\Music
- O:\fatboy\Media\My Music
- name: prefs
description: The preferences for this section
in: query
style: deepObject
schema:
type: object
example:
collectionMode: 2
hidden: 0
- name: relative
description: If set, paths are relative to `Media Upload` path
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: importFromiTunes
description: If set, import media from iTunes.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/slash-get-responses-200'
'400':
description: Section cannot be created due to bad parameters in request
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.AddSection(ctx, operations.AddSectionRequest{
Name: "",
Type: 39544,
Agent: "",
Language: "",
Locations: []string{
"O:\fatboy\\Media\\Ripped\\Music",
"O:\fatboy\\Media\\My Music",
},
Prefs: &operations.QueryParamPrefs{},
Relative: components.BoolIntOne.ToPointer(),
ImportFromiTunes: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.SlashGetResponses200 != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
AddSectionRequest req = AddSectionRequest.builder()
.name("")
.type(39544L)
.agent("")
.language("")
.locations(List.of(
"O:\fatboy\\Media\\Ripped\\Music",
"O:\fatboy\\Media\\My Music"))
.prefs(QueryParamPrefs.builder()
.build())
.relative(BoolInt.ONE)
.importFromiTunes(BoolInt.ONE)
.build();
AddSectionResponse res = sdk.library().addSection()
.request(req)
.call();
if (res.slashGetResponses200().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.addSection({
name: "",
type: 39544,
agent: "",
language: "",
locations: [
"O:\fatboy\\Media\\Ripped\\Music",
"O:\fatboy\\Media\\My Music",
],
prefs: {},
relative: BoolInt.One,
importFromiTunes: BoolInt.One,
});
console.log(result);
}
run();
/library/sections/all/refresh:
delete:
summary: Stop refresh
operationId: stopAllRefreshes
description: Stop all refreshes across all sections
tags:
- Library
security:
- token:
- admin
responses:
'200':
$ref: '#/components/responses/LibrarySections'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Library.StopAllRefreshes(ctx)
if err != nil {
log.Fatal(err)
}
if res.LibrarySections != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.StopAllRefreshesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
StopAllRefreshesResponse res = sdk.library().stopAllRefreshes()
.call();
if (res.librarySections().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.library.stopAllRefreshes();
console.log(result);
}
run();
/library/sections/prefs:
get:
summary: Get section prefs
operationId: getSectionsPrefs
description: Get a section's preferences for a metadata type
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: type
description: The metadata type
in: query
required: true
schema:
type: integer
- name: agent
description: The metadata agent in use
in: query
schema:
type: string
responses:
'200':
$ref: '#/components/responses/LibrarySections'
'400':
description: type not provided or not an integer
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetSectionsPrefs(ctx, operations.GetSectionsPrefsRequest{
Type: 460221,
})
if err != nil {
log.Fatal(err)
}
if res.LibrarySections != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetSectionsPrefsRequest;
import dev.plexapi.sdk.models.operations.GetSectionsPrefsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetSectionsPrefsRequest req = GetSectionsPrefsRequest.builder()
.type(460221L)
.build();
GetSectionsPrefsResponse res = sdk.library().getSectionsPrefs()
.request(req)
.call();
if (res.librarySections().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getSectionsPrefs({
type: 460221,
});
console.log(result);
}
run();
/library/sections/refresh:
post:
summary: Refresh all sections
operationId: refreshSectionsMetadata
description: Tell PMS to refresh all section metadata
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: force
description: Force refresh of metadata
in: query
schema:
type: boolean
responses:
'200':
$ref: '#/components/responses/200'
'503':
description: Server cannot refresh a music library when not signed in
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.RefreshSectionsMetadata(ctx, operations.RefreshSectionsMetadataRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.RefreshSectionsMetadataRequest;
import dev.plexapi.sdk.models.operations.RefreshSectionsMetadataResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
RefreshSectionsMetadataRequest req = RefreshSectionsMetadataRequest.builder()
.build();
RefreshSectionsMetadataResponse res = sdk.library().refreshSectionsMetadata()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.refreshSectionsMetadata({});
console.log(result);
}
run();
/library/tags:
get:
summary: Get all library tags of a type
operationId: getTags
description: Get all library tags of a type
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/type'
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Directory:
items:
properties:
filter:
description: The filter string to view metadata wit this tag
type: string
id:
type: integer
tag:
description: The name of the tag
type: string
tagKey:
description: The key of this tag. This is a universal key across all PMS instances and plex.tv services
type: string
tagType:
description: The type of the tag
type: integer
thumb:
description: The URL to a thumbnail for this tag
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetTags(ctx, operations.GetTagsRequest{})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetTagsRequest;
import dev.plexapi.sdk.models.operations.GetTagsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetTagsRequest req = GetTagsRequest.builder()
.build();
GetTagsResponse res = sdk.library().getTags()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getTags({});
console.log(result);
}
run();
/livetv/dvrs:
get:
summary: Get DVRs
operationId: listDVRs
description: Get the list of all available DVRs
tags:
- DVRs
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainerWithStatus'
- properties:
DVR:
items:
properties:
Device:
items:
$ref: '#/components/schemas/Device'
type: array
key:
type: string
language:
type: string
lineup:
type: string
uuid:
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.DVRs.ListDVRs(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListDVRsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListDVRsResponse res = sdk.dvRs().listDVRs()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.dvRs.listDVRs();
console.log(result);
}
run();
post:
summary: Create a DVR
operationId: createDVR
description: Creation of a DVR, after creation of a devcie and a lineup is selected
tags:
- DVRs
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: lineup
description: The EPG lineup.
in: query
schema:
type: string
example: lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT
- name: device
description: The device.
in: query
schema:
type: array
items:
type: string
example: device[]=device://tv.plex.grabbers.hdhomerun/1053C0CA
- name: language
description: The language.
in: query
schema:
type: string
example: eng
responses:
'200':
$ref: '#/components/responses/dvrRequestHandler_slash-get-responses-200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.DVRs.CreateDVR(ctx, operations.CreateDVRRequest{
Lineup: plexgo.Pointer("lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT"),
DeviceQueryParameter: []string{
"d",
"e",
"v",
"i",
"c",
"e",
"[",
"]",
"=",
"d",
"e",
"v",
"i",
"c",
"e",
":",
"/",
"/",
"t",
"v",
".",
"p",
"l",
"e",
"x",
".",
"g",
"r",
"a",
"b",
"b",
"e",
"r",
"s",
".",
"h",
"d",
"h",
"o",
"m",
"e",
"r",
"u",
"n",
"/",
"1",
"0",
"5",
"3",
"C",
"0",
"C",
"A",
},
Language: plexgo.Pointer("eng"),
})
if err != nil {
log.Fatal(err)
}
if res.DvrRequestHandlerSlashGetResponses200 != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CreateDVRRequest;
import dev.plexapi.sdk.models.operations.CreateDVRResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CreateDVRRequest req = CreateDVRRequest.builder()
.lineup("lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT")
.deviceQueryParameter(List.of(
"d",
"e",
"v",
"i",
"c",
"e",
"[",
"]",
"=",
"d",
"e",
"v",
"i",
"c",
"e",
":",
"/",
"/",
"t",
"v",
".",
"p",
"l",
"e",
"x",
".",
"g",
"r",
"a",
"b",
"b",
"e",
"r",
"s",
".",
"h",
"d",
"h",
"o",
"m",
"e",
"r",
"u",
"n",
"/",
"1",
"0",
"5",
"3",
"C",
"0",
"C",
"A"))
.language("eng")
.build();
CreateDVRResponse res = sdk.dvRs().createDVR()
.request(req)
.call();
if (res.dvrRequestHandlerSlashGetResponses200().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.dvRs.createDVR({
lineup: "lineup://tv.plex.providers.epg.onconnect/USA-HI51418-DEFAULT",
deviceQueryParameter: [
"d",
"e",
"v",
"i",
"c",
"e",
"[",
"]",
"=",
"d",
"e",
"v",
"i",
"c",
"e",
":",
"/",
"/",
"t",
"v",
".",
"p",
"l",
"e",
"x",
".",
"g",
"r",
"a",
"b",
"b",
"e",
"r",
"s",
".",
"h",
"d",
"h",
"o",
"m",
"e",
"r",
"u",
"n",
"/",
"1",
"0",
"5",
"3",
"C",
"0",
"C",
"A",
],
language: "eng",
});
console.log(result);
}
run();
/livetv/epg/channelmap:
get:
summary: Compute the best channel map
operationId: computeChannelMap
description: Compute the best channel map, given device and lineup
tags:
- EPG
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: device
description: The URI describing the device
in: query
required: true
schema:
type: string
- name: lineup
description: The URI describing the lineup
in: query
required: true
schema:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
ChannelMapping:
items:
properties:
channelKey:
type: string
deviceIdentifier:
description: The channel description on the device
type: string
favorite:
type: boolean
lineupIdentifier:
description: The channel identifier in the lineup
type: string
type: object
type: array
type: object
type: object
'404':
description: No device or provider with the identifier was found
content:
text/html: {}
'500':
description: Failed to compute channel map
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Epg.ComputeChannelMap(ctx, operations.ComputeChannelMapRequest{
DeviceQueryParameter: "",
Lineup: "",
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ComputeChannelMapRequest;
import dev.plexapi.sdk.models.operations.ComputeChannelMapResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ComputeChannelMapRequest req = ComputeChannelMapRequest.builder()
.deviceQueryParameter("")
.lineup("")
.build();
ComputeChannelMapResponse res = sdk.epg().computeChannelMap()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.epg.computeChannelMap({
deviceQueryParameter: "",
lineup: "",
});
console.log(result);
}
run();
/livetv/epg/channels:
get:
summary: Get channels for a lineup
operationId: getChannels
description: Get channels for a lineup within an EPG provider
tags:
- EPG
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: lineup
description: The URI describing the lineup
in: query
required: true
schema:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Channel:
items:
$ref: '#/components/schemas/Channel'
type: array
type: object
type: object
'404':
description: No provider with the identifier was found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Epg.GetChannels(ctx, operations.GetChannelsRequest{
Lineup: "",
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetChannelsRequest;
import dev.plexapi.sdk.models.operations.GetChannelsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetChannelsRequest req = GetChannelsRequest.builder()
.lineup("")
.build();
GetChannelsResponse res = sdk.epg().getChannels()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.epg.getChannels({
lineup: "",
});
console.log(result);
}
run();
/livetv/epg/countries:
get:
summary: Get all countries
operationId: getCountries
description: This endpoint returns a list of countries which EPG data is available for. There are three flavors, as specfied by the `flavor` attribute
tags:
- EPG
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Country:
items:
properties:
code:
description: Three letter code
type: string
example:
type: string
flavor:
description: |
- `0`: The country is divided into regions, and following the key will lead to a list of regions.
- `1`: The county is divided by postal codes, and an example code is returned in `example`.
- `2`: The country has a single postal code, returned in `example`.
enum:
- 0
- 1
- 2
type: integer
key:
type: string
language:
description: Three letter language code
type: string
languageTitle:
description: The title of the language
type: string
title:
type: string
type:
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Epg.GetCountries(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetCountriesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetCountriesResponse res = sdk.epg().getCountries()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.epg.getCountries();
console.log(result);
}
run();
/livetv/epg/languages:
get:
summary: Get all languages
operationId: getAllLanguages
description: Returns a list of all possible languages for EPG data.
tags:
- EPG
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Language:
items:
properties:
code:
description: 3 letter language code
type: string
title:
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Epg.GetAllLanguages(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetAllLanguagesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetAllLanguagesResponse res = sdk.epg().getAllLanguages()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.epg.getAllLanguages();
console.log(result);
}
run();
/livetv/epg/lineup:
get:
summary: Compute the best lineup
operationId: getLineup
description: Compute the best lineup, given lineup group and device
tags:
- EPG
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: device
description: The URI describing the device
in: query
required: true
schema:
type: string
- name: lineupGroup
description: The URI describing the lineupGroup
in: query
required: true
schema:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Activity:
description: The activity of the reload process
schema:
type: string
'404':
description: No device or provider with the identifier was found
content:
text/html: {}
'500':
description: Could not get device's channels
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Epg.GetLineup(ctx, operations.GetLineupRequest{
DeviceQueryParameter: "",
LineupGroup: "",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetLineupRequest;
import dev.plexapi.sdk.models.operations.GetLineupResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetLineupRequest req = GetLineupRequest.builder()
.deviceQueryParameter("")
.lineupGroup("")
.build();
GetLineupResponse res = sdk.epg().getLineup()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.epg.getLineup({
deviceQueryParameter: "",
lineupGroup: "",
});
console.log(result);
}
run();
/livetv/epg/lineupchannels:
get:
summary: Get the channels for mulitple lineups
operationId: getLineupChannels
description: Get the channels across multiple lineups
tags:
- EPG
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: lineup
description: The URIs describing the lineups
in: query
required: true
schema:
type: array
items:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Lineup:
items:
allOf:
- $ref: '#/components/schemas/Lineup'
- properties:
Channel:
items:
$ref: '#/components/schemas/Channel'
type: array
type: object
type: array
type: object
type: object
'404':
description: No provider with the identifier was found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Epg.GetLineupChannels(ctx, operations.GetLineupChannelsRequest{
Lineup: []string{
"",
"",
},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetLineupChannelsRequest;
import dev.plexapi.sdk.models.operations.GetLineupChannelsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetLineupChannelsRequest req = GetLineupChannelsRequest.builder()
.lineup(List.of(
"",
""))
.build();
GetLineupChannelsResponse res = sdk.epg().getLineupChannels()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.epg.getLineupChannels({
lineup: [
"",
"",
],
});
console.log(result);
}
run();
/livetv/sessions:
get:
summary: Get all sessions
operationId: getSessions
description: Get all livetv sessions and metadata
tags:
- Live TV
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.LiveTV.GetSessions(ctx)
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetSessionsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetSessionsResponse res = sdk.liveTV().getSessions()
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.liveTV.getSessions();
console.log(result);
}
run();
/log:
post:
summary: Logging a multi-line message to the Plex Media Server log
operationId: writeLog
description: |
This endpoint will write multiple lines to the main Plex Media Server log in a single request. It takes a set of query strings as would normally sent to the above PUT endpoint as a linefeed-separated block of POST data. The parameters for each query string match as above.
tags:
- Log
security:
- token:
- admin
requestBody:
required: true
description: Line separated list of log items
content:
text/plain: {}
responses:
'200':
$ref: '#/components/responses/200'
'400':
$ref: '#/components/responses/400'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$request = 'level=4&message=Test%20message%201&source=postman\n' .
'level=3&message=Test%20message%202&source=postman\n' .
'level=1&message=Test%20message%203&source=postman';
$response = $sdk->log->logMultiLine(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
req = "level=4&message=Test%20message%201&source=postman\n" +
"level=3&message=Test%20message%202&source=postman\n" +
"level=1&message=Test%20message%203&source=postman"
res = s.log.log_multi_line(req)
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"os"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
example, fileErr := os.Open("example.file")
if fileErr != nil {
panic(fileErr)
}
res, err := s.Log.WriteLog(ctx, example)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.WriteLogResponse;
import dev.plexapi.sdk.utils.Utils;
import java.io.FileInputStream;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
byte[] req = Utils.readBytesAndClose(new FileInputStream("example.file"));
WriteLogResponse res = sdk.log().writeLog()
.request(req)
.call();
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { openAsBlob } from "node:fs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.log.writeLog(await openAsBlob("example.file"));
console.log(result);
}
run();
put:
summary: Logging a single-line message to the Plex Media Server log
operationId: writeMessage
description: |
This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
Note: This endpoint responds to all HTTP verbs **except POST** but PUT is preferred
tags:
- Log
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: level
description: |
An integer log level to write to the PMS log with.
- 0: Error
- 1: Warning
- 2: Info
- 3: Debug
- 4: Verbose
in: query
schema:
type: integer
enum:
- 0
- 1
- 2
- 3
- 4
- name: message
description: The text of the message to write to the log.
in: query
schema:
type: string
- name: source
description: A string indicating the source of the message.
in: query
schema:
type: string
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Log.WriteMessage(ctx, operations.WriteMessageRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.WriteMessageRequest;
import dev.plexapi.sdk.models.operations.WriteMessageResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
WriteMessageRequest req = WriteMessageRequest.builder()
.build();
WriteMessageResponse res = sdk.log().writeMessage()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.log.writeMessage({});
console.log(result);
}
run();
/log/networked:
post:
summary: Enabling Papertrail
operationId: enablePapertrail
description: |
This endpoint will enable all Plex Media Server logs to be sent to the Papertrail networked logging site for a period of time
Note: This endpoint responds to all HTTP verbs but POST is preferred
tags:
- Log
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: minutes
description: The number of minutes logging should be sent to Papertrail
in: query
schema:
type: integer
responses:
'200':
$ref: '#/components/responses/200'
'403':
description: User doesn't have permission
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Log.EnablePapertrail(ctx, operations.EnablePapertrailRequest{})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.EnablePapertrailRequest;
import dev.plexapi.sdk.models.operations.EnablePapertrailResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
EnablePapertrailRequest req = EnablePapertrailRequest.builder()
.build();
EnablePapertrailResponse res = sdk.log().enablePapertrail()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.log.enablePapertrail({});
console.log(result);
}
run();
/media/grabbers:
get:
summary: Get available grabbers
operationId: getAvailableGrabbers
description: Get available grabbers visible to the server
tags:
- Devices
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: protocol
description: Only return grabbers providing this protocol.
in: query
schema:
type: string
example: livetv
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
MediaGrabber:
items:
properties:
identifier:
type: string
protocol:
type: string
title:
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Devices.GetAvailableGrabbers(ctx, operations.GetAvailableGrabbersRequest{
Protocol: plexgo.Pointer("livetv"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetAvailableGrabbersRequest;
import dev.plexapi.sdk.models.operations.GetAvailableGrabbersResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetAvailableGrabbersRequest req = GetAvailableGrabbersRequest.builder()
.protocol("livetv")
.build();
GetAvailableGrabbersResponse res = sdk.devices().getAvailableGrabbers()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.devices.getAvailableGrabbers({
protocol: "livetv",
});
console.log(result);
}
run();
/media/grabbers/devices:
get:
summary: Get all devices
operationId: listDevices
description: Get the list of all devices present
tags:
- Devices
security:
- token:
- admin
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithDevice'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Devices.ListDevices(ctx)
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithDevice != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListDevicesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListDevicesResponse res = sdk.devices().listDevices()
.call();
if (res.mediaContainerWithDevice().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.devices.listDevices();
console.log(result);
}
run();
post:
summary: Add a device
operationId: addDevice
description: This endpoint adds a device to an existing grabber. The device is identified, and added to the correct grabber.
tags:
- Devices
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: uri
description: The URI of the device.
in: query
schema:
type: string
example: http://10.0.0.5
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithDevice'
'400':
$ref: '#/components/responses/400'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Devices.AddDevice(ctx, operations.AddDeviceRequest{
URI: plexgo.Pointer("http://10.0.0.5"),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithDevice != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.AddDeviceRequest;
import dev.plexapi.sdk.models.operations.AddDeviceResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
AddDeviceRequest req = AddDeviceRequest.builder()
.uri("http://10.0.0.5")
.build();
AddDeviceResponse res = sdk.devices().addDevice()
.request(req)
.call();
if (res.mediaContainerWithDevice().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.devices.addDevice({
uri: "http://10.0.0.5",
});
console.log(result);
}
run();
/media/grabbers/devices/discover:
post:
summary: Tell grabbers to discover devices
operationId: discoverDevices
description: Tell grabbers to discover devices
tags:
- Devices
security:
- token:
- admin
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithDevice'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Devices.DiscoverDevices(ctx)
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithDevice != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.DiscoverDevicesResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
DiscoverDevicesResponse res = sdk.devices().discoverDevices()
.call();
if (res.mediaContainerWithDevice().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.devices.discoverDevices();
console.log(result);
}
run();
/media/providers:
get:
summary: Get the list of available media providers
operationId: listProviders
description: Get the list of all available media providers for this PMS. This will generally include the library provider and possibly EPG if DVR is set up.
tags:
- Provider
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/ServerConfiguration'
- properties:
Feature:
items:
properties:
Directory:
items:
$ref: '#/components/schemas/Directory'
type: array
key:
type: string
type:
type: string
type: object
type: array
identifier:
description: A unique identifier for the provider, e.g. `com.plexapp.plugins.library`.
type: string
protocols:
description: |-
A comma-separated list of default protocols for the provider, which can be:
- `stream`: The provider allows streaming media directly from the provider (e.g. for Vimeo). - `download`: The provider allows downloading media for offline storage, sync, etc. (e.g. Podcasts). - `livetv`: The provider provides live content which is only available on a schedule basis.
type: string
title:
description: The title of the provider.
type: string
types:
description: This attribute contains a comma-separated list of the media types exposed by the provider (e.g. `video, audio`).
type: string
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->server->getMediaProviders(
xPlexToken: 'CV5xoxjTpFKUzBTShsaf'
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.server.get_media_providers(x_plex_token="CV5xoxjTpFKUzBTShsaf")
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Provider.ListProviders(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListProvidersResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListProvidersResponse res = sdk.provider().listProviders()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.provider.listProviders();
console.log(result);
}
run();
post:
summary: Add a media provider
operationId: addProvider
description: This endpoint registers a media provider with the server. Once registered, the media server acts as a reverse proxy to the provider, allowing both local and remote providers to work.
tags:
- Provider
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: url
description: The URL of the media provider to add.
in: query
required: true
schema:
type: string
responses:
'200':
$ref: '#/components/responses/200'
'400':
$ref: '#/components/responses/400'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Provider.AddProvider(ctx, operations.AddProviderRequest{
URL: "https://steep-obedience.name/",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.AddProviderRequest;
import dev.plexapi.sdk.models.operations.AddProviderResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
AddProviderRequest req = AddProviderRequest.builder()
.url("https://steep-obedience.name/")
.build();
AddProviderResponse res = sdk.provider().addProvider()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.provider.addProvider({
url: "https://steep-obedience.name/",
});
console.log(result);
}
run();
/media/providers/refresh:
post:
summary: Refresh media providers
operationId: refreshProviders
description: Refresh all known media providers. This is useful in case a provider has updated features.
tags:
- Provider
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Provider.RefreshProviders(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.RefreshProvidersResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
RefreshProvidersResponse res = sdk.provider().refreshProviders()
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.provider.refreshProviders();
console.log(result);
}
run();
/media/subscriptions:
get:
summary: Get all subscriptions
operationId: getAllSubscriptions
description: Get all subscriptions and potentially the grabs too
tags:
- Subscriptions
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: includeGrabs
description: Indicates whether the active grabs should be included as well
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: includeStorage
description: Compute the storage of recorded items desired by this subscription
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithSubscription'
'403':
description: User cannot access DVR on this server
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Subscriptions.GetAllSubscriptions(ctx, operations.GetAllSubscriptionsRequest{
IncludeGrabs: components.BoolIntOne.ToPointer(),
IncludeStorage: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithSubscription != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetAllSubscriptionsRequest;
import dev.plexapi.sdk.models.operations.GetAllSubscriptionsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetAllSubscriptionsRequest req = GetAllSubscriptionsRequest.builder()
.includeGrabs(BoolInt.ONE)
.includeStorage(BoolInt.ONE)
.build();
GetAllSubscriptionsResponse res = sdk.subscriptions().getAllSubscriptions()
.request(req)
.call();
if (res.mediaContainerWithSubscription().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.subscriptions.getAllSubscriptions({
includeGrabs: BoolInt.One,
includeStorage: BoolInt.One,
});
console.log(result);
}
run();
post:
summary: Create a subscription
operationId: createSubscription
description: Create a subscription. The query parameters should be mostly derived from the [template](#tag/Subscriptions/operation/mediaSubscriptionsGetTemplate)
tags:
- Subscriptions
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: targetLibrarySectionID
description: The library section into which we'll grab the media. Not actually required when the subscription is to a playlist.
in: query
schema:
type: integer
example: 1
- name: targetSectionLocationID
description: The section location into which to grab.
in: query
schema:
type: integer
example: 3
- name: type
description: The type of the thing we're subscribing too (e.g. show, season).
in: query
schema:
type: integer
example: 2
- name: hints
description: 'Hints describing what we''re looking for. Note: The hint `ratingKey` is required for downloading from a PMS remote.'
in: query
style: deepObject
schema:
type: object
example:
title: Family Guy
- name: prefs
description: Subscription preferences.
in: query
style: deepObject
schema:
type: object
example:
minVideoQuality: 720
- name: params
description: |
Subscription parameters.
- `mediaProviderID`: Required for downloads to indicate which MP the subscription will download into
- `source`: Required for downloads to indicate the source of the downloaded content.
in: query
style: deepObject
schema:
type: object
example:
mediaProviderID: 1
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
MediaSubscription:
items:
$ref: '#/components/schemas/MediaSubscription'
type: array
type: object
type: object
'400':
$ref: '#/components/responses/400'
'403':
description: User cannot access DVR on this server
content:
text/html: {}
'409':
description: An subscription with the same parameters already exists
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Subscriptions.CreateSubscription(ctx, operations.CreateSubscriptionRequest{
TargetLibrarySectionID: plexgo.Pointer[int64](1),
TargetSectionLocationID: plexgo.Pointer[int64](3),
Type: plexgo.Pointer[int64](2),
Hints: &operations.Hints{},
Prefs: &operations.CreateSubscriptionQueryParamPrefs{},
Params: &operations.Params{},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CreateSubscriptionRequest req = CreateSubscriptionRequest.builder()
.targetLibrarySectionID(1L)
.targetSectionLocationID(3L)
.type(2L)
.hints(Hints.builder()
.build())
.prefs(CreateSubscriptionQueryParamPrefs.builder()
.build())
.params(Params.builder()
.build())
.build();
CreateSubscriptionResponse res = sdk.subscriptions().createSubscription()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.subscriptions.createSubscription({
targetLibrarySectionID: 1,
targetSectionLocationID: 3,
type: 2,
hints: {},
prefs: {},
params: {},
});
console.log(result);
}
run();
/media/subscriptions/process:
post:
summary: Process all subscriptions
operationId: processSubscriptions
description: Process all subscriptions asynchronously
tags:
- Subscriptions
responses:
'200':
description: OK
headers:
X-Plex-Activity:
description: The activity of the process
schema:
type: string
content:
text/html: {}
'403':
description: User cannot access DVR on this server
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Subscriptions.ProcessSubscriptions(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ProcessSubscriptionsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ProcessSubscriptionsResponse res = sdk.subscriptions().processSubscriptions()
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.subscriptions.processSubscriptions();
console.log(result);
}
run();
/media/subscriptions/scheduled:
get:
summary: Get all scheduled recordings
operationId: getScheduledRecordings
description: Get all scheduled recordings across all subscriptions
tags:
- Subscriptions
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
MediaGrabOperation:
items:
$ref: '#/components/schemas/MediaGrabOperation'
type: array
type: object
type: object
'403':
description: User cannot access DVR on this server
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Subscriptions.GetScheduledRecordings(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetScheduledRecordingsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetScheduledRecordingsResponse res = sdk.subscriptions().getScheduledRecordings()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.subscriptions.getScheduledRecordings();
console.log(result);
}
run();
/media/subscriptions/template:
get:
summary: Get the subscription template
operationId: getTemplate
description: Get the templates for a piece of media which could include fetching one airing, season, the whole show, etc.
tags:
- Subscriptions
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: guid
description: The guid of the item for which to get the template
in: query
schema:
type: string
example: plex://episode/5fc70265c40548002d539d23
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
SubscriptionTemplate:
items:
properties:
MediaSubscription:
items:
allOf:
- $ref: '#/components/schemas/MediaSubscription'
- properties:
airingsType:
type: string
librarySectionTitle:
type: string
locationPath:
type: string
parameters:
description: Parameter string for creating this subscription
type: string
selected:
type: boolean
targetLibrarySectionID:
description: Where this subscription will record to
type: integer
title:
description: The title of this subscription type
example: This Episode
type: string
type:
description: Metadata type number
type: integer
type: object
type: array
type: object
type: array
type: object
type: object
'403':
description: User cannot access DVR on this server
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Subscriptions.GetTemplate(ctx, operations.GetTemplateRequest{
GUID: plexgo.Pointer("plex://episode/5fc70265c40548002d539d23"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetTemplateRequest;
import dev.plexapi.sdk.models.operations.GetTemplateResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetTemplateRequest req = GetTemplateRequest.builder()
.guid("plex://episode/5fc70265c40548002d539d23")
.build();
GetTemplateResponse res = sdk.subscriptions().getTemplate()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.subscriptions.getTemplate({
guid: "plex://episode/5fc70265c40548002d539d23",
});
console.log(result);
}
run();
/photo/:/transcode:
get:
summary: Transcode an image
operationId: transcodeImage
description: Transcode an image, possibly changing format or size
tags:
- Transcoder
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: url
description: The source URL for the image to transcode. Note, if this URL requires a token such as `X-Plex-Token`, it should be given as a query parameter to this url.
in: query
schema:
type: string
example: /library/metadata/265/thumb/1715112705
- name: format
description: The output format for the image; defaults to jpg
in: query
required: false
schema:
type: string
enum:
- jpg
- jpeg
- png
- ppm
- name: width
description: The desired width of the output image
in: query
schema:
type: integer
- name: height
description: The desired height of the output image
in: query
schema:
type: integer
- name: quality
description: The desired quality of the output. -1 means the highest quality. Defaults to -1
in: query
required: false
schema:
maximum: 127
minimum: -1
type: integer
- name: background
description: The background color to apply before painting the image. Only really applicable if image has transparency. Defaults to none
in: query
required: false
schema:
type: string
example: '#ff5522'
- name: upscale
description: Indicates if image should be upscaled to the desired width/height. Defaults to false
in: query
required: false
schema:
$ref: "#/components/schemas/BoolInt"
- name: minSize
description: Indicates if image should be scaled to fit the smaller dimension. By default (false) the image is scaled to fit within the width/height specified but if this parameter is true, it will allow overflowing one dimension to fit the other. Essentially it is making the width/height minimum sizes of the image or sizing the image to fill the entire width/height even if it overflows one dimension.
in: query
required: false
schema:
$ref: "#/components/schemas/BoolInt"
- name: rotate
description: Obey the rotation values specified in EXIF data. Defaults to true.
in: query
required: false
schema:
$ref: "#/components/schemas/BoolInt"
- name: blur
description: Apply a blur to the image, Defaults to 0 (none)
in: query
required: false
schema:
type: integer
- name: saturation
description: Scale the image saturation by the specified percentage. Defaults to 100
in: query
required: false
schema:
maximum: 100
minimum: 0
type: integer
- name: opacity
description: Render the image at the specified opacity percentage. Defaults to 100
in: query
required: false
schema:
maximum: 100
minimum: 0
type: integer
- name: chromaSubsampling
description: |-
Use the specified chroma subsambling.
- 0: 411
- 1: 420
- 2: 422
- 3: 444
Defaults to 3 (444)
in: query
required: false
schema:
type: integer
enum:
- 0
- 1
- 2
- 3
- name: blendColor
description: The color to blend with the image. Defaults to none
in: query
required: false
schema:
type: string
example: '#ff5522'
responses:
'200':
description: The resulting image
content:
image/jpeg:
schema:
format: binary
type: string
image/png:
schema:
format: binary
type: string
image/x-portable-pixmap:
schema:
format: binary
type: string
'400':
$ref: '#/components/responses/400'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$request = new Operations\GetResizedPhotoRequest(
width: 110,
height: 165,
blur: 0,
minSize: Operations\MinSize::Zero,
upscale: Operations\Upscale::Zero,
url: '/library/metadata/49564/thumb/1654258204',
);
$response = $sdk->server->getResizedPhoto(
request: $request
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
req = Models::Operations::GetResizedPhotoRequest.new(
width: 110.0,
height: 165.0,
opacity: 643_869,
blur: 0.0,
min_size: Models::Operations::MinSize::ONE,
upscale: Models::Operations::Upscale::ONE,
url: "/library/metadata/49564/thumb/1654258204",
)
res = s.server.get_resized_photo(req)
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Transcoder.TranscodeImage(ctx, operations.TranscodeImageRequest{
URL: plexgo.Pointer("/library/metadata/265/thumb/1715112705"),
Background: plexgo.Pointer("#ff5522"),
Upscale: components.BoolIntOne.ToPointer(),
MinSize: components.BoolIntOne.ToPointer(),
Rotate: components.BoolIntOne.ToPointer(),
BlendColor: plexgo.Pointer("#ff5522"),
})
if err != nil {
log.Fatal(err)
}
if res.TwoHundredImageJpegResponseStream != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.TranscodeImageRequest;
import dev.plexapi.sdk.models.operations.TranscodeImageResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TranscodeImageRequest req = TranscodeImageRequest.builder()
.url("/library/metadata/265/thumb/1715112705")
.background("#ff5522")
.upscale(BoolInt.ONE)
.minSize(BoolInt.ONE)
.rotate(BoolInt.ONE)
.blendColor("#ff5522")
.build();
TranscodeImageResponse res = sdk.transcoder().transcodeImage()
.request(req)
.call();
if (res.twoHundredImageJpegResponseStream().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.transcoder.transcodeImage({
url: "/library/metadata/265/thumb/1715112705",
background: "#ff5522",
upscale: BoolInt.One,
minSize: BoolInt.One,
rotate: BoolInt.One,
blendColor: "#ff5522",
});
console.log(result);
}
run();
/playlists:
get:
summary: List playlists
operationId: listPlaylists
description: Gets a list of playlists and playlist folders for a user. General filters are permitted, such as `sort=lastViewedAt:desc`. A flat playlist list can be retrieved using `type=15` to limit the collection to just playlists.
tags:
- Playlist
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: playlistType
description: Limit to a type of playlist
in: query
schema:
type: string
enum:
- audio
- video
- photo
- $ref: '#/components/parameters/smart'
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithPlaylistMetadata'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->playlists->getPlaylists(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.playlists.get_playlists(playlist_type=Models::Operations::PlaylistType::AUDIO, smart=Models::Operations::QueryParamSmart::ZERO)
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Playlist.ListPlaylists(ctx, operations.ListPlaylistsRequest{})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithPlaylistMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListPlaylistsRequest;
import dev.plexapi.sdk.models.operations.ListPlaylistsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListPlaylistsRequest req = ListPlaylistsRequest.builder()
.build();
ListPlaylistsResponse res = sdk.playlist().listPlaylists()
.request(req)
.call();
if (res.mediaContainerWithPlaylistMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.playlist.listPlaylists({});
console.log(result);
}
run();
post:
summary: Create a Playlist
operationId: createPlaylist
description: Create a new playlist. By default the playlist is blank.
tags:
- Library Playlists
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: uri
description: The content URI for what we're playing (e.g. `library://...`).
in: query
schema:
type: string
- name: playQueueID
description: To create a playlist from an existing play queue.
in: query
schema:
type: integer
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithPlaylistMetadata'
'400':
$ref: '#/components/responses/400'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$request = new Operations\CreatePlaylistRequest(
title: '',
type: Operations\CreatePlaylistQueryParamType::Audio,
smart: Operations\Smart::One,
uri: 'https://short-term-disconnection.name/',
);
$response = $sdk->playlists->createPlaylist(
request: $request
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
req = Models::Operations::CreatePlaylistRequest.new(
title: "",
type: Models::Operations::CreatePlaylistQueryParamType::PHOTO,
smart: Models::Operations::Smart::ONE,
uri: "https://hoarse-testing.info/",
)
res = s.playlists.create_playlist(req)
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.LibraryPlaylists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithPlaylistMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CreatePlaylistRequest;
import dev.plexapi.sdk.models.operations.CreatePlaylistResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CreatePlaylistRequest req = CreatePlaylistRequest.builder()
.build();
CreatePlaylistResponse res = sdk.libraryPlaylists().createPlaylist()
.request(req)
.call();
if (res.mediaContainerWithPlaylistMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.libraryPlaylists.createPlaylist({});
console.log(result);
}
run();
/playlists/upload:
post:
summary: Upload
operationId: uploadPlaylist
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.
tags:
- Library Playlists
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: path
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. If the `path` argument is a directory, that path will be scanned for playlist files to be processed. Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it. The GUID of each playlist is based on the filename. If 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. The GUID of each playlist is based on the filename.
in: query
schema:
type: string
example: /home/barkley/playlist.m3u
- name: force
description: Force overwriting of duplicate playlists. By default, a playlist file uploaded with the same path will overwrite the existing playlist. The `force` argument is used to disable overwriting. If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
'403':
$ref: '#/components/responses/200'
'500':
description: The playlist could not be imported
content:
text/html: {}
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->playlists->uploadPlaylist(
path: '/home/barkley/playlist.m3u',
force: Operations\QueryParamForce::One,
sectionID: 1
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.playlists.upload_playlist(path="/home/barkley/playlist.m3u", force=Models::Operations::QueryParamForce::ZERO, section_id=1)
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.LibraryPlaylists.UploadPlaylist(ctx, operations.UploadPlaylistRequest{
Path: plexgo.Pointer("/home/barkley/playlist.m3u"),
Force: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.UploadPlaylistRequest;
import dev.plexapi.sdk.models.operations.UploadPlaylistResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
UploadPlaylistRequest req = UploadPlaylistRequest.builder()
.path("/home/barkley/playlist.m3u")
.force(BoolInt.ONE)
.build();
UploadPlaylistResponse res = sdk.libraryPlaylists().uploadPlaylist()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.libraryPlaylists.uploadPlaylist({
path: "/home/barkley/playlist.m3u",
force: BoolInt.One,
});
console.log(result);
}
run();
/playQueues:
post:
summary: Create a play queue
operationId: createPlayQueue
description: |-
Makes a new play queue for a device. The source of the playqueue can either be a URI, or a playlist. The response is a media container with the initial items in the queue. Each item in the queue will be a regular item but with `playQueueItemID` - a unique ID since the queue could have repeated items with the same `ratingKey`.
Note: Either `uri` or `playlistID` must be specified
tags:
- Play Queue
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: uri
description: The content URI for what we're playing.
in: query
schema:
type: string
- name: playlistID
description: the ID of the playlist we're playing.
in: query
schema:
type: integer
- name: type
description: The type of play queue to create
in: query
required: true
schema:
type: string
enum:
- audio
- video
- photo
- name: key
description: The key of the first item to play, defaults to the first in the play queue.
in: query
schema:
type: string
- name: shuffle
description: Whether to shuffle the playlist, defaults to 0.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: repeat
description: If the PQ is bigger than the window, fill any empty space with wraparound items, defaults to 0.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: continuous
description: Whether to create a continuous play queue (e.g. from an episode), defaults to 0.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: extrasPrefixCount
description: Number of trailers to prepend a movie with not including the pre-roll. If omitted the pre-roll will not be returned in the play queue. When resuming a movie `extrasPrefixCount` should be omitted as a parameter instead of passing 0.
in: query
schema:
type: integer
- name: recursive
description: Only applies to queues of type photo, whether to retrieve all descendent photos from an album or section, defaults to 1.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: onDeck
description: Only applies to queues of type show or seasons, whether to return a queue that is started on the On Deck episode if one exists. Otherwise begins the play queue on the beginning of the show or season.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
playQueueID:
description: The ID of the play queue, which is used in subsequent requests.
type: integer
playQueueLastAddedItemID:
description: Defines where the "Up Next" region starts
type: string
playQueueSelectedItemID:
description: The queue item ID of the currently selected item.
type: integer
playQueueSelectedItemOffset:
description: The offset of the selected item in the play queue, from the beginning of the queue.
type: integer
playQueueSelectedMetadataItemID:
description: The metadata item ID of the currently selected item (matches `ratingKey` attribute in metadata item if the media provider is a library).
type: integer
playQueueShuffled:
description: Whether or not the queue is shuffled.
type: boolean
playQueueSourceURI:
description: The original URI used to create the play queue.
type: string
playQueueTotalCount:
description: The total number of items in the play queue.
type: integer
playQueueVersion:
description: The version of the play queue. It increments every time a change is made to the play queue to assist clients in knowing when to refresh.
type: integer
type: object
type: object
'400':
$ref: '#/components/responses/400'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.PlayQueue.CreatePlayQueue(ctx, operations.CreatePlayQueueRequest{
Type: operations.TypeAudio,
Shuffle: components.BoolIntOne.ToPointer(),
Repeat: components.BoolIntOne.ToPointer(),
Continuous: components.BoolIntOne.ToPointer(),
Recursive: components.BoolIntOne.ToPointer(),
OnDeck: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CreatePlayQueueRequest req = CreatePlayQueueRequest.builder()
.type(Type.AUDIO)
.shuffle(BoolInt.ONE)
.repeat(BoolInt.ONE)
.continuous(BoolInt.ONE)
.recursive(BoolInt.ONE)
.onDeck(BoolInt.ONE)
.build();
CreatePlayQueueResponse res = sdk.playQueue().createPlayQueue()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { CreatePlayQueueType } from "@lukehagar/plexjs/sdk/models/operations";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.playQueue.createPlayQueue({
type: CreatePlayQueueType.Audio,
shuffle: BoolInt.One,
repeat: BoolInt.One,
continuous: BoolInt.One,
recursive: BoolInt.One,
onDeck: BoolInt.One,
});
console.log(result);
}
run();
/security/resources:
get:
summary: Get Source Connection Information
operationId: getSourceConnectionInformation
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.
tags:
- General
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: source
description: The source identifier with an included prefix.
in: query
required: true
schema:
type: string
- name: refresh
description: Force refresh
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Device:
properties:
accessToken:
type: string
clientIdentifier:
type: string
Connection:
items:
properties:
address:
type: string
local:
description: Indicates if the connection is the server's LAN address
type: boolean
port:
type: integer
protocol:
type: string
relay:
description: Indicates the connection is over a relayed connection
type: boolean
uri:
type: string
type: object
type: array
name:
type: string
type: object
type: object
type: object
'400':
description: A query param is missing or the wrong value
content:
text/html: {}
'403':
description: Invalid or no token provided or a transient token could not be created
content:
text/html: {}
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->authentication->getSourceConnectionInformation(
source: 'server://client-identifier'
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.authentication.get_source_connection_information(source="server://client-identifier")
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.General.GetSourceConnectionInformation(ctx, operations.GetSourceConnectionInformationRequest{
Source: "",
Refresh: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationRequest;
import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetSourceConnectionInformationRequest req = GetSourceConnectionInformationRequest.builder()
.source("")
.refresh(BoolInt.ONE)
.build();
GetSourceConnectionInformationResponse res = sdk.general().getSourceConnectionInformation()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.general.getSourceConnectionInformation({
source: "",
refresh: BoolInt.One,
});
console.log(result);
}
run();
/security/token:
post:
summary: Get Transient Tokens
operationId: getTransientToken
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.
Note: This endpoint responds to all HTTP verbs but POST in preferred
tags:
- General
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: type
description: The value `delegation` is the only supported `type` parameter.
in: query
required: true
schema:
type: string
enum:
- delegation
- name: scope
description: The value `all` is the only supported `scope` parameter.
in: query
required: true
schema:
type: string
enum:
- all
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
token:
description: The transient token
type: string
type: object
type: object
'400':
description: A query param is missing or the wrong value
content:
text/html: {}
'403':
description: Invalid or no token provided or a transient token could not be created
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.General.GetTransientToken(ctx, operations.GetTransientTokenRequest{
Type: operations.QueryParamTypeDelegation,
Scope: operations.ScopeAll,
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetTransientTokenRequest req = GetTransientTokenRequest.builder()
.type(QueryParamType.DELEGATION)
.scope(Scope.ALL)
.build();
GetTransientTokenResponse res = sdk.general().getTransientToken()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { GetTransientTokenScope, GetTransientTokenType } from "@lukehagar/plexjs/sdk/models/operations";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.general.getTransientToken({
type: GetTransientTokenType.Delegation,
scope: GetTransientTokenScope.All,
});
console.log(result);
}
run();
/services/ultrablur/colors:
get:
summary: Get UltraBlur Colors
operationId: getColors
description: Retrieves the four colors extracted from an image for clients to use to generate an ultrablur image.
tags:
- UltraBlur
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: url
description: Url for image which requires color extraction. Can be relative PMS library path or absolute url.
in: query
schema:
type: string
example: /library/metadata/217745/art/1718931408
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
UltraBlurColors:
items:
properties:
bottomLeft:
description: The color (hex) for the bottom left quadrant.
type: string
bottomRight:
description: The color (hex) for the bottom right quadrant.
type: string
topLeft:
description: The color (hex) for the top left quadrant.
type: string
topRight:
description: The color (hex) for the top right quadrant.
type: string
type: object
type: array
type: object
type: object
'404':
description: The image url could not be found.
content:
text/html: {}
'500':
description: The server was unable to successfully extract the UltraBlur colors.
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.UltraBlur.GetColors(ctx, operations.GetColorsRequest{
URL: plexgo.Pointer("/library/metadata/217745/art/1718931408"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetColorsRequest;
import dev.plexapi.sdk.models.operations.GetColorsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetColorsRequest req = GetColorsRequest.builder()
.url("/library/metadata/217745/art/1718931408")
.build();
GetColorsResponse res = sdk.ultraBlur().getColors()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.ultraBlur.getColors({
url: "/library/metadata/217745/art/1718931408",
});
console.log(result);
}
run();
/services/ultrablur/image:
get:
summary: Get UltraBlur Image
operationId: getImage
description: Retrieves a server-side generated UltraBlur image based on the provided color inputs. Clients should always call this via the photo transcoder endpoint.
tags:
- UltraBlur
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: topLeft
description: The base color (hex) for the top left quadrant.
in: query
schema:
type: string
example: 3f280a
- name: topRight
description: The base color (hex) for the top right quadrant.
in: query
schema:
type: string
example: 6b4713
- name: bottomRight
description: The base color (hex) for the bottom right quadrant.
in: query
schema:
type: string
example: 0f2a43
- name: bottomLeft
description: The base color (hex) for the bottom left quadrant.
in: query
schema:
type: string
example: 1c425d
- name: width
description: Width in pixels for the image.
in: query
schema:
maximum: 3840
minimum: 320
type: integer
example: 1920
- name: height
description: Height in pixels for the image.
in: query
schema:
maximum: 2160
minimum: 240
type: integer
example: 1080
- name: noise
description: Whether to add noise to the ouput image. Noise can reduce color banding with the gradients. Image sizes with noise will be larger.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
responses:
'200':
description: OK
content:
image/png:
schema:
format: binary
type: string
'400':
description: Requested width and height parameters are out of bounds (maximum 3840 x 2160)
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.UltraBlur.GetImage(ctx, operations.GetImageRequest{
TopLeft: plexgo.Pointer("3f280a"),
TopRight: plexgo.Pointer("6b4713"),
BottomRight: plexgo.Pointer("0f2a43"),
BottomLeft: plexgo.Pointer("1c425d"),
Width: plexgo.Pointer[int64](1920),
Height: plexgo.Pointer[int64](1080),
Noise: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.ResponseStream != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetImageRequest;
import dev.plexapi.sdk.models.operations.GetImageResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetImageRequest req = GetImageRequest.builder()
.topLeft("3f280a")
.topRight("6b4713")
.bottomRight("0f2a43")
.bottomLeft("1c425d")
.width(1920L)
.height(1080L)
.noise(BoolInt.ONE)
.build();
GetImageResponse res = sdk.ultraBlur().getImage()
.request(req)
.call();
if (res.responseStream().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.ultraBlur.getImage({
topLeft: "3f280a",
topRight: "6b4713",
bottomRight: "0f2a43",
bottomLeft: "1c425d",
width: 1920,
height: 1080,
noise: BoolInt.One,
});
console.log(result);
}
run();
/status/sessions:
get:
summary: List Sessions
operationId: listSessions
description: List all current playbacks on this server
tags:
- Status
security:
- token:
- admin
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Metadata:
items:
allOf:
- properties:
Player:
$ref: '#/components/schemas/Player'
Session:
$ref: '#/components/schemas/Session'
User:
$ref: '#/components/schemas/User'
type: object
- $ref: '#/components/schemas/Metadata'
type: array
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->sessions->getSessions(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.sessions.get_sessions()
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Status.ListSessions(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListSessionsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListSessionsResponse res = sdk.status().listSessions()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.status.listSessions();
console.log(result);
}
run();
/status/sessions/background:
get:
summary: Get background tasks
operationId: getBackgroundTasks
description: Get the list of all background tasks
tags:
- Status
security:
- token:
- admin
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
TranscodeJob:
items:
properties:
generatorID:
type: integer
key:
type: string
progress:
maximum: 100
minimum: 0
type: number
ratingKey:
type: string
remaining:
description: The number of seconds remaining in this job
type: integer
size:
description: The size of the result so far
type: integer
speed:
description: The speed of the transcode; 1.0 means real-time
type: number
targetTagID:
description: The tag associated with the job. This could be the tag containing the optimizer settings.
type: integer
thumb:
type: string
title:
type: string
type:
enum:
- transcode
type: string
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Status.GetBackgroundTasks(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetBackgroundTasksResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetBackgroundTasksResponse res = sdk.status().getBackgroundTasks()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.status.getBackgroundTasks();
console.log(result);
}
run();
/status/sessions/history/all:
get:
summary: List Playback History
operationId: listPlaybackHistory
description: |-
List all playback history (Admin can see all users, others can only see their own).
Pagination should be used on this endpoint. Additionally this endpoint supports `includeFields`, `excludeFields`, `includeElements`, and `excludeElements` parameters.
tags:
- Status
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: accountID
description: The account id to restrict view history
in: query
schema:
type: integer
- name: viewedAt
description: The time period to restrict history (typically of the form `viewedAt>=12456789`)
in: query
schema:
type: integer
- name: librarySectionID
description: The library section id to restrict view history
in: query
schema:
type: integer
- name: metadataItemID
description: The metadata item to restrict view history (can provide the id for a show to see all of that show's view history). Note this is translated to `metadata_items.id`, `parents.id`, or `grandparents.id` internally depending on the metadata type.
in: query
schema:
type: integer
- name: sort
description: The field on which to sort. Multiple orderings can be specified separated by `,` and the direction specified following a `:` (`desc` or `asc`; `asc` is assumed if not provided). Note `metadataItemID` may not be used here.
in: query
schema:
type: array
items:
type: string
example: viewedAt:desc,accountID
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Metadata:
items:
properties:
accountID:
description: The account id of this playback
type: integer
deviceID:
description: The device id which played the item
type: integer
historyKey:
description: The key for this individual history item
type: string
key:
description: The metadata key for the item played
type: string
librarySectionID:
description: The library section id containing the item played
type: string
originallyAvailableAt:
description: The originally available at of the item played
type: string
ratingKey:
description: The rating key for the item played
type: string
thumb:
description: The thumb of the item played
type: string
title:
description: The title of the item played
type: string
type:
description: The metadata type of the item played
type: string
viewedAt:
description: The time when the item was played
type: integer
type: object
type: array
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$filter = new Operations\QueryParamFilter();
$response = $sdk->sessions->getSessionHistory(
sort: 'viewedAt:desc',
accountId: 1,
filter: $filter,
librarySectionID: 12
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.sessions.get_session_history(sort="", account_id=1, filter=Models::Operations::QueryParamFilter.new(), library_section_id=12)
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Status.ListPlaybackHistory(ctx, operations.ListPlaybackHistoryRequest{
Sort: []string{
"v",
"i",
"e",
"w",
"e",
"d",
"A",
"t",
":",
"d",
"e",
"s",
"c",
",",
"a",
"c",
"c",
"o",
"u",
"n",
"t",
"I",
"D",
},
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListPlaybackHistoryRequest;
import dev.plexapi.sdk.models.operations.ListPlaybackHistoryResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListPlaybackHistoryRequest req = ListPlaybackHistoryRequest.builder()
.sort(List.of(
"v",
"i",
"e",
"w",
"e",
"d",
"A",
"t",
":",
"d",
"e",
"s",
"c",
",",
"a",
"c",
"c",
"o",
"u",
"n",
"t",
"I",
"D"))
.build();
ListPlaybackHistoryResponse res = sdk.status().listPlaybackHistory()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.status.listPlaybackHistory({
sort: [
"v",
"i",
"e",
"w",
"e",
"d",
"A",
"t",
":",
"d",
"e",
"s",
"c",
",",
"a",
"c",
"c",
"o",
"u",
"n",
"t",
"I",
"D",
],
});
console.log(result);
}
run();
/status/sessions/terminate:
post:
summary: Terminate a session
operationId: terminateSession
description: Terminate a playback session kicking off the user
tags:
- Status
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sessionId
description: The session id (found in the `Session` element in [/status/sessions](#tag/Status/operation/statusGetSlash))
in: query
required: true
schema:
type: string
example: cdefghijklmnopqrstuvwxyz
- name: reason
description: The reason to give to the user (typically displayed in the client)
in: query
schema:
type: string
example: Stop Playing
responses:
'200':
$ref: '#/components/responses/200'
'401':
description: Server does not have the feature enabled
content:
text/html: {}
'403':
description: sessionId is empty
content:
text/html: {}
'404':
description: Session not found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Status.TerminateSession(ctx, operations.TerminateSessionRequest{
SessionID: "cdefghijklmnopqrstuvwxyz",
Reason: plexgo.Pointer("Stop Playing"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.TerminateSessionRequest;
import dev.plexapi.sdk.models.operations.TerminateSessionResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TerminateSessionRequest req = TerminateSessionRequest.builder()
.sessionId("cdefghijklmnopqrstuvwxyz")
.reason("Stop Playing")
.build();
TerminateSessionResponse res = sdk.status().terminateSession()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.status.terminateSession({
sessionId: "cdefghijklmnopqrstuvwxyz",
reason: "Stop Playing",
});
console.log(result);
}
run();
/updater/apply:
put:
summary: Applying updates
operationId: applyUpdates
description: Apply any downloaded updates. Note that the two parameters `tonight` and `skip` are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed.
tags:
- Updater
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: tonight
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 immediately.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: skip
description: Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
description: The update process started correctly
content:
text/html: {}
'400':
description: This system cannot install updates
content:
text/html: {}
'500':
description: The update process failed to start
content:
text/html: {}
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->updater->applyUpdates(
tonight: Operations\Tonight::One,
skip: Operations\Skip::One
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.updater.apply_updates(tonight=Models::Operations::Tonight::ONE, skip=Models::Operations::Skip::ONE)
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Updater.ApplyUpdates(ctx, operations.ApplyUpdatesRequest{
Tonight: components.BoolIntOne.ToPointer(),
Skip: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ApplyUpdatesRequest;
import dev.plexapi.sdk.models.operations.ApplyUpdatesResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ApplyUpdatesRequest req = ApplyUpdatesRequest.builder()
.tonight(BoolInt.ONE)
.skip(BoolInt.ONE)
.build();
ApplyUpdatesResponse res = sdk.updater().applyUpdates()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.updater.applyUpdates({
tonight: BoolInt.One,
skip: BoolInt.One,
});
console.log(result);
}
run();
/updater/check:
put:
summary: Checking for updates
operationId: checkUpdates
description: Perform an update check and potentially download
tags:
- Updater
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: download
description: Indicate that you want to start download any updates found.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Operations;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->updater->checkForUpdates(
download: Operations\Download::One
);
if ($response->statusCode === 200) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.updater.check_for_updates(download=Models::Operations::Download::ONE)
if res.status_code == 200
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Updater.CheckUpdates(ctx, operations.CheckUpdatesRequest{
Download: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CheckUpdatesRequest;
import dev.plexapi.sdk.models.operations.CheckUpdatesResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CheckUpdatesRequest req = CheckUpdatesRequest.builder()
.download(BoolInt.ONE)
.build();
CheckUpdatesResponse res = sdk.updater().checkUpdates()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.updater.checkUpdates({
download: BoolInt.One,
});
console.log(result);
}
run();
/updater/status:
get:
summary: Querying status of updates
operationId: getUpdatesStatus
description: Get the status of updating the server
tags:
- Updater
security:
- token:
- admin
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- properties:
autoUpdateVersion:
description: The version of the updater (currently `1`)
type: integer
canInstall:
description: Indicates whether this install can be updated through these endpoints (typically only on MacOS and Windows)
type: boolean
checkedAt:
description: The last time a check for updates was performed
type: integer
downloadURL:
description: The URL where the update is available
type: string
Release:
items:
properties:
added:
description: A list of what has been added in this version
type: string
downloadURL:
description: The URL of where this update is available
type: string
fixed:
description: A list of what has been fixed in this version
type: string
key:
description: The URL key of the update
type: string
state:
description: |
The status of this update.
- available - This release is available
- downloading - This release is downloading
- downloaded - This release has been downloaded
- installing - This release is installing
- tonight - This release will be installed tonight
- skipped - This release has been skipped
- error - This release has an error
- notify - This release is only notifying it is available (typically because it cannot be installed on this setup)
- done - This release is complete
enum:
- available
- downloading
- downloaded
- installing
- tonight
- skipped
- error
- notify
- done
type: string
version:
description: The version available
type: string
type: object
type: array
status:
description: The current error code (`0` means no error)
type: integer
type: object
type: object
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->updater->getUpdateStatus(
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.updater.get_update_status()
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity(""),
)
res, err := s.Updater.GetUpdatesStatus(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetUpdatesStatusResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetUpdatesStatusResponse res = sdk.updater().getUpdatesStatus()
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI();
async function run() {
const result = await plexAPI.updater.getUpdatesStatus();
console.log(result);
}
run();
/{transcodeType}/:/transcode/universal/decision:
get:
summary: Make a decision on media playback
operationId: makeDecision
description: Make a decision on media playback based on client profile, and requested settings such as bandwidth and resolution.
tags:
- Transcoder
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/transcodeType'
- $ref: '#/components/parameters/transcodeSessionId'
- $ref: '#/components/parameters/advancedSubtitles'
- name: audioBoost
description: Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc)
in: query
schema:
minimum: 1
type: integer
example: 50
- name: audioChannelCount
description: Target video number of audio channels.
in: query
schema:
maximum: 8
minimum: 1
type: integer
example: 5
- name: autoAdjustQuality
description: Indicates the client supports ABR.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: autoAdjustSubtitle
description: Indicates if the server should adjust subtitles based on Voice Activity Data.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: directPlay
description: Indicates the client supports direct playing the indicated content.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: directStream
description: Indicates the client supports direct streaming the video of the indicated content.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: directStreamAudio
description: Indicates the client supports direct streaming the audio of the indicated content.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: disableResolutionRotation
description: Indicates if resolution should be adjusted for orientation.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: hasMDE
description: Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: location
description: Network type of the client, can be used to help determine target bitrate.
in: query
schema:
type: string
enum:
- lan
- wan
- cellular
example: wan
- name: mediaBufferSize
description: Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks.
in: query
schema:
type: integer
example: 102400
- name: mediaIndex
description: Index of the media to transcode. -1 or not specified indicates let the server choose.
in: query
schema:
type: integer
example: 0
- name: musicBitrate
description: Target bitrate for audio only files (in kbps, used to transcode).
in: query
schema:
minimum: 0
type: integer
example: 5000
- name: offset
description: Offset from the start of the media (in seconds).
in: query
schema:
type: number
example: 90.5
- name: partIndex
description: Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode
in: query
schema:
type: integer
example: 0
- name: path
description: Internal PMS path of the media to transcode.
in: query
schema:
type: string
example: /library/metadata/151671
- name: peakBitrate
description: Maximum bitrate (in kbps) to use in ABR.
in: query
schema:
minimum: 0
type: integer
example: 12000
- name: photoResolution
description: Target photo resolution.
in: query
schema:
type: string
pattern: ^\d[x:]\d$
example: 1080x1080
- name: protocol
description: |
Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022)
in: query
schema:
type: string
enum:
- http
- hls
- dash
example: dash
- name: secondsPerSegment
description: Number of seconds to include in each transcoded segment
in: query
schema:
type: integer
example: 5
- name: subtitleSize
description: Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect)
in: query
schema:
minimum: 1
type: integer
example: 50
- name: subtitles
description: |
Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream
in: query
schema:
type: string
enum:
- auto
- burn
- none
- sidecar
- embedded
- segmented
- unknown
example: Burn
- name: videoBitrate
description: Target video bitrate (in kbps).
in: query
schema:
minimum: 0
type: integer
example: 12000
- name: videoQuality
description: Target photo quality.
in: query
schema:
maximum: 99
minimum: 0
type: integer
example: 50
- name: videoResolution
description: Target maximum video resolution.
in: query
schema:
type: string
pattern: ^\d[x:]\d$
example: 1080x1080
- name: X-Plex-Client-Identifier
description: Unique per client.
in: header
required: true
schema:
type: string
- name: X-Plex-Client-Profile-Extra
description: See [Profile Augmentations](#section/API-Info/Profile-Augmentations) .
in: header
schema:
type: string
example: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)
- name: X-Plex-Client-Profile-Name
description: Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile.
in: header
schema:
type: string
example: generic
- name: X-Plex-Device
description: Device the client is running on
in: header
schema:
type: string
example: Windows
- name: X-Plex-Model
description: Model of the device the client is running on
in: header
schema:
type: string
example: standalone
- name: X-Plex-Platform
description: Client Platform
in: header
schema:
type: string
example: Chrome
- name: X-Plex-Platform-Version
description: Client Platform Version
in: header
schema:
type: string
example: 135
- name: X-Plex-Session-Identifier
description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)
in: header
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithDecision'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Transcoder.MakeDecision(ctx, operations.MakeDecisionRequest{
TranscodeType: components.TranscodeTypeMusic,
AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(),
AudioBoost: plexgo.Pointer[int64](50),
AudioChannelCount: plexgo.Pointer[int64](5),
AutoAdjustQuality: components.BoolIntOne.ToPointer(),
AutoAdjustSubtitle: components.BoolIntOne.ToPointer(),
DirectPlay: components.BoolIntOne.ToPointer(),
DirectStream: components.BoolIntOne.ToPointer(),
DirectStreamAudio: components.BoolIntOne.ToPointer(),
DisableResolutionRotation: components.BoolIntOne.ToPointer(),
HasMDE: components.BoolIntOne.ToPointer(),
Location: operations.LocationWan.ToPointer(),
MediaBufferSize: plexgo.Pointer[int64](102400),
MediaIndex: plexgo.Pointer[int64](0),
MusicBitrate: plexgo.Pointer[int64](5000),
Offset: plexgo.Pointer[float64](90.5),
PartIndex: plexgo.Pointer[int64](0),
Path: plexgo.Pointer("/library/metadata/151671"),
PeakBitrate: plexgo.Pointer[int64](12000),
PhotoResolution: plexgo.Pointer("1080x1080"),
Protocol: operations.ProtocolDash.ToPointer(),
SecondsPerSegment: plexgo.Pointer[int64](5),
SubtitleSize: plexgo.Pointer[int64](50),
VideoBitrate: plexgo.Pointer[int64](12000),
VideoQuality: plexgo.Pointer[int64](50),
VideoResolution: plexgo.Pointer("1080x1080"),
XPlexClientProfileExtra: plexgo.Pointer("add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)"),
XPlexClientProfileName: plexgo.Pointer("generic"),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithDecision != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
MakeDecisionRequest req = MakeDecisionRequest.builder()
.transcodeType(TranscodeType.MUSIC)
.advancedSubtitles(AdvancedSubtitles.BURN)
.audioBoost(50L)
.audioChannelCount(5L)
.autoAdjustQuality(BoolInt.ONE)
.autoAdjustSubtitle(BoolInt.ONE)
.directPlay(BoolInt.ONE)
.directStream(BoolInt.ONE)
.directStreamAudio(BoolInt.ONE)
.disableResolutionRotation(BoolInt.ONE)
.hasMDE(BoolInt.ONE)
.location(Location.WAN)
.mediaBufferSize(102400L)
.mediaIndex(0L)
.musicBitrate(5000L)
.offset(90.5)
.partIndex(0L)
.path("/library/metadata/151671")
.peakBitrate(12000L)
.photoResolution("1080x1080")
.protocol(Protocol.DASH)
.secondsPerSegment(5L)
.subtitleSize(50L)
.videoBitrate(12000L)
.videoQuality(50L)
.videoResolution("1080x1080")
.xPlexClientProfileExtra("add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)")
.xPlexClientProfileName("generic")
.build();
MakeDecisionResponse res = sdk.transcoder().makeDecision()
.request(req)
.call();
if (res.mediaContainerWithDecision().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { MakeDecisionLocation, MakeDecisionProtocol } from "@lukehagar/plexjs/sdk/models/operations";
import { Accepts, AdvancedSubtitles, BoolInt, TranscodeType } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.transcoder.makeDecision({
transcodeType: TranscodeType.Music,
advancedSubtitles: AdvancedSubtitles.Burn,
audioBoost: 50,
audioChannelCount: 5,
autoAdjustQuality: BoolInt.One,
autoAdjustSubtitle: BoolInt.One,
directPlay: BoolInt.One,
directStream: BoolInt.One,
directStreamAudio: BoolInt.One,
disableResolutionRotation: BoolInt.One,
hasMDE: BoolInt.One,
location: MakeDecisionLocation.Wan,
mediaBufferSize: 102400,
mediaIndex: 0,
musicBitrate: 5000,
offset: 90.5,
partIndex: 0,
path: "/library/metadata/151671",
peakBitrate: 12000,
photoResolution: "1080x1080",
protocol: MakeDecisionProtocol.Dash,
secondsPerSegment: 5,
subtitleSize: 50,
videoBitrate: 12000,
videoQuality: 50,
videoResolution: "1080x1080",
xPlexClientProfileExtra: "add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)",
xPlexClientProfileName: "generic",
});
console.log(result);
}
run();
/{transcodeType}/:/transcode/universal/fallback:
post:
summary: Manually trigger a transcoder fallback
operationId: triggerFallback
description: 'Manually trigger a transcoder fallback ex: HEVC to h.264 or hw to sw'
tags:
- Transcoder
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/transcodeType'
- $ref: '#/components/parameters/transcodeSessionId'
responses:
'200':
$ref: '#/components/responses/200'
'404':
description: Session ID does not exist
content:
text/html: {}
'412':
description: Transcode could not fallback
content:
text/html: {}
'500':
description: Transcode failed to fallback
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Transcoder.TriggerFallback(ctx, operations.TriggerFallbackRequest{
TranscodeType: components.TranscodeTypeAudio,
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.TriggerFallbackRequest;
import dev.plexapi.sdk.models.operations.TriggerFallbackResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.TranscodeType;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TriggerFallbackRequest req = TriggerFallbackRequest.builder()
.transcodeType(TranscodeType.AUDIO)
.build();
TriggerFallbackResponse res = sdk.transcoder().triggerFallback()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, TranscodeType } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.transcoder.triggerFallback({
transcodeType: TranscodeType.Audio,
});
console.log(result);
}
run();
/{transcodeType}/:/transcode/universal/subtitles:
get:
summary: Transcode subtitles
operationId: transcodeSubtitles
description: Only transcode subtitle streams.
tags:
- Transcoder
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- $ref: '#/components/parameters/transcodeType'
- $ref: '#/components/parameters/transcodeSessionId'
- $ref: '#/components/parameters/advancedSubtitles'
- name: audioBoost
description: Percentage of original audio loudness to use when transcoding (100 is equivalent to original volume, 50 is half, 200 is double, etc)
in: query
schema:
minimum: 1
type: integer
example: 50
- name: audioChannelCount
description: Target video number of audio channels.
in: query
schema:
maximum: 8
minimum: 1
type: integer
example: 5
- name: autoAdjustQuality
description: Indicates the client supports ABR.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: autoAdjustSubtitle
description: Indicates if the server should adjust subtitles based on Voice Activity Data.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: directPlay
description: Indicates the client supports direct playing the indicated content.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: directStream
description: Indicates the client supports direct streaming the video of the indicated content.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: directStreamAudio
description: Indicates the client supports direct streaming the audio of the indicated content.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: disableResolutionRotation
description: Indicates if resolution should be adjusted for orientation.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: hasMDE
description: Ignore client profiles when determining if direct play is possible. Only has an effect when directPlay=1 and both mediaIndex and partIndex are specified and neither are -1
in: query
schema:
$ref: "#/components/schemas/BoolInt"
example: 1
- name: location
description: Network type of the client, can be used to help determine target bitrate.
in: query
schema:
type: string
enum:
- lan
- wan
- cellular
example: wan
- name: mediaBufferSize
description: Buffer size used in playback (in KB). Clients should specify a lower bound if not known exactly. This value could make the difference between transcoding and direct play on bandwidth constrained networks.
in: query
schema:
type: integer
example: 102400
- name: mediaIndex
description: Index of the media to transcode. -1 or not specified indicates let the server choose.
in: query
schema:
type: integer
example: 0
- name: musicBitrate
description: Target bitrate for audio only files (in kbps, used to transcode).
in: query
schema:
minimum: 0
type: integer
example: 5000
- name: offset
description: Offset from the start of the media (in seconds).
in: query
schema:
type: number
example: 90.5
- name: partIndex
description: Index of the part to transcode. -1 or not specified indicates the server should join parts together in a transcode
in: query
schema:
type: integer
example: 0
- name: path
description: Internal PMS path of the media to transcode.
in: query
schema:
type: string
example: /library/metadata/151671
- name: peakBitrate
description: Maximum bitrate (in kbps) to use in ABR.
in: query
schema:
minimum: 0
type: integer
example: 12000
- name: photoResolution
description: Target photo resolution.
in: query
schema:
type: string
pattern: ^\d[x:]\d$
example: 1080x1080
- name: protocol
description: |
Indicates the network streaming protocol to be used for the transcode session: * 'http' - include the file in the http response such as MKV streaming * 'hls' - hls stream (RFC 8216) * 'dash' - dash stream (ISO/IEC 23009-1:2022)
in: query
schema:
type: string
enum:
- http
- hls
- dash
example: dash
- name: secondsPerSegment
description: Number of seconds to include in each transcoded segment
in: query
schema:
type: integer
example: 5
- name: subtitleSize
description: Percentage of original subtitle size to use when burning subtitles (100 is equivalent to original size, 50 is half, ect)
in: query
schema:
minimum: 1
type: integer
example: 50
- name: subtitles
description: |
Indicates how subtitles should be included: * 'auto' - Compute the appropriate subtitle setting automatically * 'burn' - Burn the selected subtitle; auto if no selected subtitle * 'none' - Ignore all subtitle streams * 'sidecar' - The selected subtitle should be provided as a sidecar * 'embedded' - The selected subtitle should be provided as an embedded stream * 'segmented' - The selected subtitle should be provided as a segmented stream
in: query
schema:
type: string
enum:
- auto
- burn
- none
- sidecar
- embedded
- segmented
- unknown
example: Burn
- name: videoBitrate
description: Target video bitrate (in kbps).
in: query
schema:
minimum: 0
type: integer
example: 12000
- name: videoQuality
description: Target photo quality.
in: query
schema:
maximum: 99
minimum: 0
type: integer
example: 50
- name: videoResolution
description: Target maximum video resolution.
in: query
schema:
type: string
pattern: ^\d[x:]\d$
example: 1080x1080
- name: X-Plex-Client-Identifier
description: Unique per client.
in: header
required: true
schema:
type: string
- name: X-Plex-Client-Profile-Extra
description: See [Profile Augmentations](#section/API-Info/Profile-Augmentations) .
in: header
schema:
type: string
example: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)
- name: X-Plex-Client-Profile-Name
description: Which built in Client Profile to use in the decision. Generally should only be used to specify the Generic profile.
in: header
schema:
type: string
example: generic
- name: X-Plex-Device
description: Device the client is running on
in: header
schema:
type: string
example: Windows
- name: X-Plex-Model
description: Model of the device the client is running on
in: header
schema:
type: string
example: standalone
- name: X-Plex-Platform
description: Client Platform
in: header
schema:
type: string
example: Chrome
- name: X-Plex-Platform-Version
description: Client Platform Version
in: header
schema:
type: string
example: 135
- name: X-Plex-Session-Identifier
description: Unique per client playback session. Used if a client can playback multiple items at a time (such as a browser with multiple tabs)
in: header
schema:
type: string
responses:
'200':
description: Transcoded subtitle file
content:
text/srt:
example: "1\n00:00:02,499 --> 00:00:06,416\n[SERENE MUSIC]\n\n2\n00:00:11,791 --> 00:00:13,958\n[BROOK BABBLES] \n[FLY BUZZES]\n\n3\n00:00:16,166 --> 00:00:17,666\n[BIRD TWEETS]\n\n4\n00:00:17,666 --> 00:00:18,708\n[WINGS FLAP]\n\n5\n00:00:19,833 --> 00:00:20,374\n[BIRD TWEETS] \n[WINGS FLAP]\n\n6\n00:00:20,374 --> 00:00:21,041\n[THUD]\n\n7\n00:00:21,374 --> 00:00:22,249\n[THUD]\n\n8\n00:00:22,249 --> 00:00:23,083\n[SQUIRREL LAUGHS]\n\n9\n00:00:26,249 --> 00:00:27,541\n[SNORES]\n\n10\n00:00:29,416 --> 00:00:30,708\n[SNORES]\n\n11\n00:00:32,749 --> 00:00:34,041\n[BUNNY SNORES]\n\n12\n00:00:35,916 --> 00:00:37,249\n[BUNNY SNORES]\n"
'400':
$ref: '#/components/responses/400'
'403':
$ref: '#/components/responses/403'
'404':
$ref: '#/components/responses/404'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Transcoder.TranscodeSubtitles(ctx, operations.TranscodeSubtitlesRequest{
TranscodeType: components.TranscodeTypeAudio,
AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(),
AudioBoost: plexgo.Pointer[int64](50),
AudioChannelCount: plexgo.Pointer[int64](5),
AutoAdjustQuality: components.BoolIntOne.ToPointer(),
AutoAdjustSubtitle: components.BoolIntOne.ToPointer(),
DirectPlay: components.BoolIntOne.ToPointer(),
DirectStream: components.BoolIntOne.ToPointer(),
DirectStreamAudio: components.BoolIntOne.ToPointer(),
DisableResolutionRotation: components.BoolIntOne.ToPointer(),
HasMDE: components.BoolIntOne.ToPointer(),
Location: operations.QueryParamLocationWan.ToPointer(),
MediaBufferSize: plexgo.Pointer[int64](102400),
MediaIndex: plexgo.Pointer[int64](0),
MusicBitrate: plexgo.Pointer[int64](5000),
Offset: plexgo.Pointer[float64](90.5),
PartIndex: plexgo.Pointer[int64](0),
Path: plexgo.Pointer("/library/metadata/151671"),
PeakBitrate: plexgo.Pointer[int64](12000),
PhotoResolution: plexgo.Pointer("1080x1080"),
Protocol: operations.QueryParamProtocolDash.ToPointer(),
SecondsPerSegment: plexgo.Pointer[int64](5),
SubtitleSize: plexgo.Pointer[int64](50),
VideoBitrate: plexgo.Pointer[int64](12000),
VideoQuality: plexgo.Pointer[int64](50),
VideoResolution: plexgo.Pointer("1080x1080"),
XPlexClientProfileExtra: plexgo.Pointer("add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)"),
XPlexClientProfileName: plexgo.Pointer("generic"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.*;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
TranscodeSubtitlesRequest req = TranscodeSubtitlesRequest.builder()
.transcodeType(TranscodeType.AUDIO)
.advancedSubtitles(AdvancedSubtitles.BURN)
.audioBoost(50L)
.audioChannelCount(5L)
.autoAdjustQuality(BoolInt.ONE)
.autoAdjustSubtitle(BoolInt.ONE)
.directPlay(BoolInt.ONE)
.directStream(BoolInt.ONE)
.directStreamAudio(BoolInt.ONE)
.disableResolutionRotation(BoolInt.ONE)
.hasMDE(BoolInt.ONE)
.location(QueryParamLocation.WAN)
.mediaBufferSize(102400L)
.mediaIndex(0L)
.musicBitrate(5000L)
.offset(90.5)
.partIndex(0L)
.path("/library/metadata/151671")
.peakBitrate(12000L)
.photoResolution("1080x1080")
.protocol(QueryParamProtocol.DASH)
.secondsPerSegment(5L)
.subtitleSize(50L)
.videoBitrate(12000L)
.videoQuality(50L)
.videoResolution("1080x1080")
.xPlexClientProfileExtra("add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)")
.xPlexClientProfileName("generic")
.build();
TranscodeSubtitlesResponse res = sdk.transcoder().transcodeSubtitles()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { TranscodeSubtitlesLocation, TranscodeSubtitlesProtocol } from "@lukehagar/plexjs/sdk/models/operations";
import { Accepts, AdvancedSubtitles, BoolInt, TranscodeType } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.transcoder.transcodeSubtitles({
transcodeType: TranscodeType.Audio,
advancedSubtitles: AdvancedSubtitles.Burn,
audioBoost: 50,
audioChannelCount: 5,
autoAdjustQuality: BoolInt.One,
autoAdjustSubtitle: BoolInt.One,
directPlay: BoolInt.One,
directStream: BoolInt.One,
directStreamAudio: BoolInt.One,
disableResolutionRotation: BoolInt.One,
hasMDE: BoolInt.One,
location: TranscodeSubtitlesLocation.Wan,
mediaBufferSize: 102400,
mediaIndex: 0,
musicBitrate: 5000,
offset: 90.5,
partIndex: 0,
path: "/library/metadata/151671",
peakBitrate: 12000,
photoResolution: "1080x1080",
protocol: TranscodeSubtitlesProtocol.Dash,
secondsPerSegment: 5,
subtitleSize: 50,
videoBitrate: 12000,
videoQuality: 50,
videoResolution: "1080x1080",
xPlexClientProfileExtra: "add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.frameRate&value=60&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&videoCodec=h264%2Chevc&audioCodec=aac&protocol=dash)",
xPlexClientProfileName: "generic",
});
console.log(result);
}
run();
/activities/{activityId}:
delete:
summary: Cancel a running activity
operationId: cancelActivity
description: Cancel a running activity. Admins can cancel all activities but other users can only cancel their own
tags:
- Activities
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: activityId
description: The UUID of the activity to cancel.
in: path
required: true
schema:
type: string
example: d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: Activity is not cancellable
content:
text/html: {}
'404':
description: No activity with the provided id is found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Activities.CancelActivity(ctx, operations.CancelActivityRequest{
ActivityID: "d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CancelActivityRequest;
import dev.plexapi.sdk.models.operations.CancelActivityResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CancelActivityRequest req = CancelActivityRequest.builder()
.activityId("d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e")
.build();
CancelActivityResponse res = sdk.activities().cancelActivity()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.activities.cancelActivity({
activityId: "d6199ba1-fb5e-4cae-bf17-1a5369c1cf1e",
});
console.log(result);
}
run();
/butler/{task}:
delete:
summary: Stop a single Butler task
operationId: stopTask
description: |
This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists
tags:
- Butler
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: task
description: The task name
in: path
required: true
schema:
type: string
enum:
- AutomaticUpdates
- BackupDatabase
- ButlerTaskGenerateAdMarkers
- ButlerTaskGenerateCreditsMarkers
- ButlerTaskGenerateIntroMarkers
- ButlerTaskGenerateVoiceActivity
- CleanOldBundles
- CleanOldCacheFiles
- DeepMediaAnalysis
- GarbageCollectBlobs
- GarbageCollectLibraryMedia
- GenerateBlurHashes
- GenerateChapterThumbs
- GenerateMediaIndexFiles
- LoudnessAnalysis
- MusicAnalysis
- OptimizeDatabase
- RefreshEpgGuides
- RefreshLibraries
- RefreshLocalMedia
- RefreshPeriodicMetadata
- UpgradeMediaAnalysis
responses:
'200':
$ref: '#/components/responses/200'
'404':
description: No task with this name was found or no task with this name was running
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Butler.StopTask(ctx, operations.StopTaskRequest{
Task: operations.TaskCleanOldBundles,
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
StopTaskRequest req = StopTaskRequest.builder()
.task(Task.CLEAN_OLD_BUNDLES)
.build();
StopTaskResponse res = sdk.butler().stopTask()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { StopTaskTask } from "@lukehagar/plexjs/sdk/models/operations";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.butler.stopTask({
task: StopTaskTask.CleanOldBundles,
});
console.log(result);
}
run();
post:
summary: Start a single Butler task
operationId: startTask
description: |
This endpoint will attempt to start a specific Butler task by name.
tags:
- Butler
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: task
description: The task name
in: path
required: true
schema:
type: string
enum:
- AutomaticUpdates
- BackupDatabase
- ButlerTaskGenerateAdMarkers
- ButlerTaskGenerateCreditsMarkers
- ButlerTaskGenerateIntroMarkers
- ButlerTaskGenerateVoiceActivity
- CleanOldBundles
- CleanOldCacheFiles
- DeepMediaAnalysis
- GarbageCollectBlobs
- GarbageCollectLibraryMedia
- GenerateBlurHashes
- GenerateChapterThumbs
- GenerateMediaIndexFiles
- LoudnessAnalysis
- MusicAnalysis
- OptimizeDatabase
- RefreshEpgGuides
- RefreshLibraries
- RefreshLocalMedia
- RefreshPeriodicMetadata
- UpgradeMediaAnalysis
responses:
'200':
description: Task started
content:
text/html: {}
'202':
description: Task is already running
content:
text/html: {}
'404':
description: No task with this name was found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Butler.StartTask(ctx, operations.StartTaskRequest{
Task: operations.PathParamTaskRefreshLocalMedia,
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.*;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
StartTaskRequest req = StartTaskRequest.builder()
.task(PathParamTask.REFRESH_LOCAL_MEDIA)
.build();
StartTaskResponse res = sdk.butler().startTask()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { StartTaskTask } from "@lukehagar/plexjs/sdk/models/operations";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.butler.startTask({
task: StartTaskTask.RefreshLocalMedia,
});
console.log(result);
}
run();
/downloadQueue/{queueId}:
get:
summary: Get a download queue
operationId: getDownloadQueue
description: |
Available: 0.2.0
Get a download queue by its id
tags:
- Download Queue
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: queueId
description: The queue id
in: path
required: true
schema:
type: integer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
DownloadQueue:
items:
properties:
id:
type: integer
itemCount:
type: integer
status:
description: |
The state of this queue
- deciding: At least one item is still being decided
- waiting: At least one item is waiting for transcode and none are currently transcoding
- processing: At least one item is being transcoded
- done: All items are available (or potentially expired)
- error: At least one item has encountered an error
enum:
- deciding
- waiting
- processing
- done
- error
type: string
type: object
type: array
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.DownloadQueue.GetDownloadQueue(ctx, operations.GetDownloadQueueRequest{
QueueID: 922802,
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetDownloadQueueRequest;
import dev.plexapi.sdk.models.operations.GetDownloadQueueResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetDownloadQueueRequest req = GetDownloadQueueRequest.builder()
.queueId(922802L)
.build();
GetDownloadQueueResponse res = sdk.downloadQueue().getDownloadQueue()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.downloadQueue.getDownloadQueue({
queueId: 922802,
});
console.log(result);
}
run();
/downloadQueue/{queueId}/add:
post:
summary: Add to download queue
operationId: addDownloadQueueItems
description: |
Available: 0.2.0
Add items to the download queue
tags:
- Download Queue
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: queueId
description: The queue id
in: path
required: true
schema:
type: integer
- name: keys
description: Keys to add
in: query
required: true
explode: false
schema:
type: array
items:
type: string
example:
- /library/metadata/3
- /library/metadata/6
- $ref: '#/components/parameters/advancedSubtitles'
- $ref: '#/components/parameters/audioBoost'
- $ref: '#/components/parameters/audioChannelCount'
- $ref: '#/components/parameters/autoAdjustQuality'
- $ref: '#/components/parameters/autoAdjustSubtitle'
- $ref: '#/components/parameters/directPlay'
- $ref: '#/components/parameters/directStream'
- $ref: '#/components/parameters/directStreamAudio'
- $ref: '#/components/parameters/disableResolutionRotation'
- $ref: '#/components/parameters/hasMDE'
- $ref: '#/components/parameters/location'
- $ref: '#/components/parameters/mediaBufferSize'
- $ref: '#/components/parameters/mediaIndex'
- $ref: '#/components/parameters/musicBitrate'
- $ref: '#/components/parameters/offset'
- $ref: '#/components/parameters/partIndex'
- $ref: '#/components/parameters/path'
- $ref: '#/components/parameters/peakBitrate'
- $ref: '#/components/parameters/photoResolution'
- $ref: '#/components/parameters/protocol'
- $ref: '#/components/parameters/secondsPerSegment'
- $ref: '#/components/parameters/subtitleSize'
- $ref: '#/components/parameters/subtitles'
- $ref: '#/components/parameters/videoBitrate'
- $ref: '#/components/parameters/videoQuality'
- $ref: '#/components/parameters/videoResolution'
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
AddedQueueItems:
items:
properties:
id:
description: The queue item id that was added or the existing one if an item already exists in this queue with the same parameters
type: integer
key:
description: The key added to the queue
type: string
type: object
type: array
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.DownloadQueue.AddDownloadQueueItems(ctx, operations.AddDownloadQueueItemsRequest{
QueueID: 984925,
Keys: []string{
"/library/metadata/3",
"/library/metadata/6",
},
AdvancedSubtitles: components.AdvancedSubtitlesBurn.ToPointer(),
AudioBoost: plexgo.Pointer[int64](50),
AudioChannelCount: plexgo.Pointer[int64](5),
AutoAdjustQuality: components.BoolIntOne.ToPointer(),
AutoAdjustSubtitle: components.BoolIntOne.ToPointer(),
DirectPlay: components.BoolIntOne.ToPointer(),
DirectStream: components.BoolIntOne.ToPointer(),
DirectStreamAudio: components.BoolIntOne.ToPointer(),
DisableResolutionRotation: components.BoolIntOne.ToPointer(),
HasMDE: components.BoolIntOne.ToPointer(),
Location: components.LocationWan.ToPointer(),
MediaBufferSize: plexgo.Pointer[int64](102400),
MediaIndex: plexgo.Pointer[int64](0),
MusicBitrate: plexgo.Pointer[int64](5000),
Offset: plexgo.Pointer[float64](90.5),
PartIndex: plexgo.Pointer[int64](0),
Path: plexgo.Pointer("/library/metadata/151671"),
PeakBitrate: plexgo.Pointer[int64](12000),
PhotoResolution: plexgo.Pointer("1080x1080"),
Protocol: components.ProtocolDash.ToPointer(),
SecondsPerSegment: plexgo.Pointer[int64](5),
SubtitleSize: plexgo.Pointer[int64](50),
VideoBitrate: plexgo.Pointer[int64](12000),
VideoQuality: plexgo.Pointer[int64](50),
VideoResolution: plexgo.Pointer("1080x1080"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.AddDownloadQueueItemsRequest;
import dev.plexapi.sdk.models.operations.AddDownloadQueueItemsResponse;
import dev.plexapi.sdk.models.shared.*;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
AddDownloadQueueItemsRequest req = AddDownloadQueueItemsRequest.builder()
.queueId(984925L)
.keys(List.of(
"/library/metadata/3",
"/library/metadata/6"))
.advancedSubtitles(AdvancedSubtitles.BURN)
.audioBoost(50L)
.audioChannelCount(5L)
.autoAdjustQuality(BoolInt.ONE)
.autoAdjustSubtitle(BoolInt.ONE)
.directPlay(BoolInt.ONE)
.directStream(BoolInt.ONE)
.directStreamAudio(BoolInt.ONE)
.disableResolutionRotation(BoolInt.ONE)
.hasMDE(BoolInt.ONE)
.location(Location.WAN)
.mediaBufferSize(102400L)
.mediaIndex(0L)
.musicBitrate(5000L)
.offset(90.5)
.partIndex(0L)
.path("/library/metadata/151671")
.peakBitrate(12000L)
.photoResolution("1080x1080")
.protocol(Protocol.DASH)
.secondsPerSegment(5L)
.subtitleSize(50L)
.videoBitrate(12000L)
.videoQuality(50L)
.videoResolution("1080x1080")
.build();
AddDownloadQueueItemsResponse res = sdk.downloadQueue().addDownloadQueueItems()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, AdvancedSubtitles, BoolInt, LocationParameter, Protocol } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.downloadQueue.addDownloadQueueItems({
queueId: 984925,
keys: [
"/library/metadata/3",
"/library/metadata/6",
],
advancedSubtitles: AdvancedSubtitles.Burn,
audioBoost: 50,
audioChannelCount: 5,
autoAdjustQuality: BoolInt.One,
autoAdjustSubtitle: BoolInt.One,
directPlay: BoolInt.One,
directStream: BoolInt.One,
directStreamAudio: BoolInt.One,
disableResolutionRotation: BoolInt.One,
hasMDE: BoolInt.One,
location: LocationParameter.Wan,
mediaBufferSize: 102400,
mediaIndex: 0,
musicBitrate: 5000,
offset: 90.5,
partIndex: 0,
path: "/library/metadata/151671",
peakBitrate: 12000,
photoResolution: "1080x1080",
protocol: Protocol.Dash,
secondsPerSegment: 5,
subtitleSize: 50,
videoBitrate: 12000,
videoQuality: 50,
videoResolution: "1080x1080",
});
console.log(result);
}
run();
/downloadQueue/{queueId}/items:
get:
summary: Get download queue items
operationId: listDownloadQueueItems
description: |
Available: 0.2.0
Get items from a download queue
tags:
- Download Queue
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: queueId
description: The queue id
in: path
required: true
schema:
type: integer
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
DownloadQueueItem:
items:
properties:
DecisionResult:
properties:
availableBandwidth:
description: The maximum bitrate set when item was added
type: integer
directPlayDecisionCode:
type: integer
directPlayDecisionText:
type: string
generalDecisionCode:
type: integer
generalDecisionText:
type: string
mdeDecisionCode:
description: The code indicating the status of evaluation of playback when client indicates `hasMDE=1`
type: integer
mdeDecisionText:
description: Descriptive text for the above code
type: string
transcodeDecisionCode:
type: integer
transcodeDecisionText:
type: string
type: object
error:
description: The error encountered in transcoding or decision
type: string
id:
type: integer
key:
type: string
queueId:
type: integer
status:
description: |
The state of the item:
- deciding: The item decision is pending
- waiting: The item is waiting for transcode
- processing: The item is being transcoded
- available: The item is available for download
- error: The item encountered an error in the decision or transcode
- expired: The transcoded item has timed out and is no longer available
enum:
- deciding
- waiting
- processing
- available
- error
- expired
type: string
transcode:
description: The transcode session object which is not yet documented otherwise it'd be a $ref here.
type: object
TranscodeSession:
$ref: '#/components/schemas/TranscodeSession'
type: object
type: array
type: object
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.DownloadQueue.ListDownloadQueueItems(ctx, operations.ListDownloadQueueItemsRequest{
QueueID: 524138,
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListDownloadQueueItemsRequest;
import dev.plexapi.sdk.models.operations.ListDownloadQueueItemsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListDownloadQueueItemsRequest req = ListDownloadQueueItemsRequest.builder()
.queueId(524138L)
.build();
ListDownloadQueueItemsResponse res = sdk.downloadQueue().listDownloadQueueItems()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.downloadQueue.listDownloadQueueItems({
queueId: 524138,
});
console.log(result);
}
run();
/hubs/metadata/{metadataId}:
get:
summary: Get hubs for section by metadata item
operationId: getMetadataHubs
description: Get the hubs for a section by metadata item. Currently only for music sections
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: metadataId
description: The metadata ID for the hubs to fetch
in: path
required: true
schema:
type: integer
- $ref: '#/components/parameters/count'
- name: onlyTransient
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
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/responses-200'
'400':
description: No metadata with that id or permission is denied
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetMetadataHubs(ctx, operations.GetMetadataHubsRequest{
MetadataID: 605482,
OnlyTransient: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithHubs != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetMetadataHubsRequest;
import dev.plexapi.sdk.models.operations.GetMetadataHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetMetadataHubsRequest req = GetMetadataHubsRequest.builder()
.metadataId(605482L)
.onlyTransient(BoolInt.ONE)
.build();
GetMetadataHubsResponse res = sdk.hubs().getMetadataHubs()
.request(req)
.call();
if (res.mediaContainerWithHubs().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getMetadataHubs({
metadataId: 605482,
onlyTransient: BoolInt.One,
});
console.log(result);
}
run();
/hubs/metadata/{metadataId}/postplay:
get:
summary: Get postplay hubs
operationId: getPostplayHubs
description: Get the hubs for a metadata to be displayed in post play
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: metadataId
description: The metadata ID for the hubs to fetch
in: path
required: true
schema:
type: integer
- $ref: '#/components/parameters/count'
- name: onlyTransient
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
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/responses-200'
'400':
description: No metadata with that id or permission is denied
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetPostplayHubs(ctx, operations.GetPostplayHubsRequest{
MetadataID: 441419,
OnlyTransient: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithHubs != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetPostplayHubsRequest;
import dev.plexapi.sdk.models.operations.GetPostplayHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetPostplayHubsRequest req = GetPostplayHubsRequest.builder()
.metadataId(441419L)
.onlyTransient(BoolInt.ONE)
.build();
GetPostplayHubsResponse res = sdk.hubs().getPostplayHubs()
.request(req)
.call();
if (res.mediaContainerWithHubs().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getPostplayHubs({
metadataId: 441419,
onlyTransient: BoolInt.One,
});
console.log(result);
}
run();
/hubs/metadata/{metadataId}/related:
get:
summary: Get related hubs
operationId: getRelatedHubs
description: Get the hubs for a metadata related to the provided metadata item
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: metadataId
description: The metadata ID for the hubs to fetch
in: path
required: true
schema:
type: integer
- $ref: '#/components/parameters/count'
- name: onlyTransient
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
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/responses-200'
'400':
description: No metadata with that id or permission is denied
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetRelatedHubs(ctx, operations.GetRelatedHubsRequest{
MetadataID: 8858,
OnlyTransient: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithHubs != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetRelatedHubsRequest;
import dev.plexapi.sdk.models.operations.GetRelatedHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetRelatedHubsRequest req = GetRelatedHubsRequest.builder()
.metadataId(8858L)
.onlyTransient(BoolInt.ONE)
.build();
GetRelatedHubsResponse res = sdk.hubs().getRelatedHubs()
.request(req)
.call();
if (res.mediaContainerWithHubs().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getRelatedHubs({
metadataId: 8858,
onlyTransient: BoolInt.One,
});
console.log(result);
}
run();
/hubs/sections/{sectionId}:
get:
summary: Get section hubs
operationId: getSectionHubs
description: Get the hubs for a single section
tags:
- Hubs
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sectionId
description: The section ID for the hubs to fetch
in: path
required: true
schema:
type: integer
- $ref: '#/components/parameters/count'
- name: onlyTransient
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
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Hub:
items:
$ref: '#/components/schemas/Hub'
type: array
type: object
type: object
'400':
description: No section with that id or permission is denied
content:
text/html: {}
x-codeSamples:
- lang: php
label: PlexPHP
source: |-
declare(strict_types=1);
require 'vendor/autoload.php';
use LukeHagar\Plex_API;
$sdk = Plex_API\PlexAPI::builder()
->setSecurity(
''
)
->build();
$response = $sdk->hubs->getLibraryHubs(
sectionId: 492.74
);
if ($response->object !== null) {
// handle response
}
- lang: ruby
label: PlexRuby
source: |-
require 'plex_ruby_sdk'
s = ::PlexRubySDK::PlexAPI.new(
security: Models::Shared::Security.new(
access_token: "",
),
)
res = s.hubs.get_library_hubs(section_id=6728.76, count=639.24, only_transient=Models::Operations::QueryParamOnlyTransient::ONE)
if ! res.object.nil?
# handle response
end
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.GetSectionHubs(ctx, operations.GetSectionHubsRequest{
SectionID: 336924,
OnlyTransient: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetSectionHubsRequest;
import dev.plexapi.sdk.models.operations.GetSectionHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetSectionHubsRequest req = GetSectionHubsRequest.builder()
.sectionId(336924L)
.onlyTransient(BoolInt.ONE)
.build();
GetSectionHubsResponse res = sdk.hubs().getSectionHubs()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.getSectionHubs({
sectionId: 336924,
onlyTransient: BoolInt.One,
});
console.log(result);
}
run();
/hubs/sections/{sectionId}/manage:
delete:
summary: Reset hubs to defaults
operationId: resetSectionDefaults
description: Reset hubs for this section to defaults and delete custom hubs
tags:
- Hubs
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sectionId
description: The section ID for the hubs to reorder
in: path
required: true
schema:
type: integer
responses:
'200':
$ref: '#/components/responses/200'
'403':
$ref: '#/components/responses/403'
'404':
description: Section id was not found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.ResetSectionDefaults(ctx, operations.ResetSectionDefaultsRequest{
SectionID: 383022,
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ResetSectionDefaultsRequest;
import dev.plexapi.sdk.models.operations.ResetSectionDefaultsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ResetSectionDefaultsRequest req = ResetSectionDefaultsRequest.builder()
.sectionId(383022L)
.build();
ResetSectionDefaultsResponse res = sdk.hubs().resetSectionDefaults()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.resetSectionDefaults({
sectionId: 383022,
});
console.log(result);
}
run();
get:
summary: Get hubs
operationId: listHubs
description: Get the list of hubs including both built-in and custom
tags:
- Hubs
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sectionId
description: The section ID for the hubs to reorder
in: path
required: true
schema:
type: integer
- name: metadataItemId
description: Restrict hubs to ones relevant to the provided metadata item
in: query
schema:
type: integer
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
properties:
MediaContainer:
allOf:
- $ref: '#/components/schemas/MediaContainer'
- properties:
Hub:
items:
properties:
homeVisibility:
description: |
Whether this hub is visible on the home screen
- all: Visible to all users
- none: Visible to no users
- admin: Visible to only admin users
- shared: Visible to shared users
enum:
- all
- none
- admin
- shared
type: string
identifier:
description: The identifier for this hub
type: string
promotedToOwnHome:
description: Whether this hub is visible to admin user home
type: boolean
promotedToRecommended:
description: Whether this hub is promoted to all for recommendations
type: boolean
promotedToSharedHome:
description: Whether this hub is visible to shared user's home
type: boolean
recommendationsVisibility:
description: |
The visibility of this hub in recommendations:
- all: Visible to all users
- none: Visible to no users
- admin: Visible to only admin users
- shared: Visible to shared users
enum:
- all
- none
- admin
- shared
type: string
title:
description: The title of this hub
type: string
type: object
type: array
type: object
type: object
'403':
$ref: '#/components/responses/403'
'404':
description: Section id was not found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.ListHubs(ctx, operations.ListHubsRequest{
SectionID: 442546,
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.ListHubsRequest;
import dev.plexapi.sdk.models.operations.ListHubsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
ListHubsRequest req = ListHubsRequest.builder()
.sectionId(442546L)
.build();
ListHubsResponse res = sdk.hubs().listHubs()
.request(req)
.call();
if (res.object().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.listHubs({
sectionId: 442546,
});
console.log(result);
}
run();
post:
summary: Create a custom hub
operationId: createCustomHub
description: Create a custom hub based on a metadata item
tags:
- Hubs
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sectionId
description: The section ID for the hubs to reorder
in: path
required: true
schema:
type: integer
- name: metadataItemId
description: The metadata item on which to base this hub. This must currently be a collection
in: query
required: true
schema:
type: integer
- name: promotedToRecommended
description: Whether this hub should be displayed in recommended
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: promotedToOwnHome
description: Whether this hub should be displayed in admin's home
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: promotedToSharedHome
description: Whether this hub should be displayed in shared user's home
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: A hub could not be created with this metadata item
content:
text/html: {}
'403':
$ref: '#/components/responses/403'
'404':
description: Section id or metadata item was not found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.CreateCustomHub(ctx, operations.CreateCustomHubRequest{
SectionID: 869922,
MetadataItemID: 703843,
PromotedToRecommended: components.BoolIntOne.ToPointer(),
PromotedToOwnHome: components.BoolIntOne.ToPointer(),
PromotedToSharedHome: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.CreateCustomHubRequest;
import dev.plexapi.sdk.models.operations.CreateCustomHubResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
CreateCustomHubRequest req = CreateCustomHubRequest.builder()
.sectionId(869922L)
.metadataItemId(703843L)
.promotedToRecommended(BoolInt.ONE)
.promotedToOwnHome(BoolInt.ONE)
.promotedToSharedHome(BoolInt.ONE)
.build();
CreateCustomHubResponse res = sdk.hubs().createCustomHub()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.createCustomHub({
sectionId: 869922,
metadataItemId: 703843,
promotedToRecommended: BoolInt.One,
promotedToOwnHome: BoolInt.One,
promotedToSharedHome: BoolInt.One,
});
console.log(result);
}
run();
/hubs/sections/{sectionId}/manage/move:
put:
summary: Move Hub
operationId: moveHub
description: Changed the ordering of a hub among others hubs
tags:
- Hubs
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: sectionId
description: The section ID for the hubs to reorder
in: path
required: true
schema:
type: integer
- name: identifier
description: The identifier of the hub to move
in: query
required: true
schema:
type: string
- name: after
description: The identifier of the hub to order this hub after (or empty/missing to put this hub first)
in: query
schema:
type: string
responses:
'200':
$ref: '#/components/responses/get-responses-200'
'403':
$ref: '#/components/responses/403'
'404':
description: Section id was not found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Hubs.MoveHub(ctx, operations.MoveHubRequest{
SectionID: 755710,
Identifier: "",
})
if err != nil {
log.Fatal(err)
}
if res.GetResponses200 != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.MoveHubRequest;
import dev.plexapi.sdk.models.operations.MoveHubResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
MoveHubRequest req = MoveHubRequest.builder()
.sectionId(755710L)
.identifier("")
.build();
MoveHubResponse res = sdk.hubs().moveHub()
.request(req)
.call();
if (res.getResponses200().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.hubs.moveHub({
sectionId: 755710,
identifier: "",
});
console.log(result);
}
run();
/library/collections/{collectionId}/items:
get:
summary: Get items in a collection
operationId: getCollectionItems
description: Get items in a collection. Note if this collection contains more than 100 items, paging must be used.
tags:
- Content
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: collectionId
description: The collection id
in: path
required: true
schema:
type: integer
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
'404':
description: Collection not found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Content.GetCollectionItems(ctx, operations.GetCollectionItemsRequest{
CollectionID: 314585,
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetCollectionItemsRequest;
import dev.plexapi.sdk.models.operations.GetCollectionItemsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetCollectionItemsRequest req = GetCollectionItemsRequest.builder()
.collectionId(314585L)
.build();
GetCollectionItemsResponse res = sdk.content().getCollectionItems()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.content.getCollectionItems({
collectionId: 314585,
});
console.log(result);
}
run();
put:
summary: Add items to a collection
operationId: addCollectionItems
description: Add items to a collection by uri
tags:
- Library Collections
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: collectionId
description: The collection id
in: path
required: true
schema:
type: integer
- name: uri
description: The URI describing the items to add to this collection
in: query
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
'404':
description: Collection not found
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.LibraryCollections.AddCollectionItems(ctx, operations.AddCollectionItemsRequest{
CollectionID: 338144,
URI: "https://expensive-bakeware.com",
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.AddCollectionItemsRequest;
import dev.plexapi.sdk.models.operations.AddCollectionItemsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
AddCollectionItemsRequest req = AddCollectionItemsRequest.builder()
.collectionId(338144L)
.uri("https://expensive-bakeware.com")
.build();
AddCollectionItemsResponse res = sdk.libraryCollections().addCollectionItems()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.libraryCollections.addCollectionItems({
collectionId: 338144,
uri: "https://expensive-bakeware.com",
});
console.log(result);
}
run();
/library/metadata/{ids}:
delete:
summary: Delete a metadata item
operationId: deleteMetadataItem
description: Delete a single metadata item from the library, deleting media as well
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
- name: proxy
description: Whether proxy items, such as media optimized versions, should also be deleted. Defaults to false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: Media items could not be deleted
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.DeleteMetadataItem(ctx, operations.DeleteMetadataItemRequest{
Ids: "",
Proxy: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.DeleteMetadataItemRequest;
import dev.plexapi.sdk.models.operations.DeleteMetadataItemResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
DeleteMetadataItemRequest req = DeleteMetadataItemRequest.builder()
.ids("")
.proxy(BoolInt.ONE)
.build();
DeleteMetadataItemResponse res = sdk.library().deleteMetadataItem()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.deleteMetadataItem({
ids: "",
proxy: BoolInt.One,
});
console.log(result);
}
run();
get:
summary: Get a metadata item
operationId: getMetadataItem
description: Get one or more metadata items.
tags:
- Content
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: array
items:
type: string
- name: asyncCheckFiles
description: Determines if file check should be performed asynchronously. An activity is created to indicate progress. Default is false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: asyncRefreshLocalMediaAgent
description: Determines if local media agent refresh should be performed asynchronously. An activity is created to indicate progress. Default is false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: asyncRefreshAnalysis
description: Determines if analysis refresh should be performed asynchronously. An activity is created to indicate progress. Default is false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: checkFiles
description: Determines if file check should be performed synchronously. Specifying `asyncCheckFiles` will cause this option to be ignored. Default is false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: skipRefresh
description: Determines if synchronous local media agent and analysis refresh should be skipped. Specifying async versions will cause synchronous versions to be skipped. Default is false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: checkFileAvailability
description: Determines if file existence check should be performed synchronously. Specifying `checkFiles` will imply this option. Default is false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: asyncAugmentMetadata
description: Add metadata augmentations. An activity is created to indicate progress. Option will be ignored if specified by non-admin or if multiple metadata items are requested. Default is false.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
- name: augmentCount
description: Number of augmentations to add. Requires `asyncAugmentMetadata` to be specified.
in: query
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Content.GetMetadataItem(ctx, operations.GetMetadataItemRequest{
Ids: []string{},
AsyncCheckFiles: components.BoolIntOne.ToPointer(),
AsyncRefreshLocalMediaAgent: components.BoolIntOne.ToPointer(),
AsyncRefreshAnalysis: components.BoolIntOne.ToPointer(),
CheckFiles: components.BoolIntOne.ToPointer(),
SkipRefresh: components.BoolIntOne.ToPointer(),
CheckFileAvailability: components.BoolIntOne.ToPointer(),
AsyncAugmentMetadata: components.BoolIntOne.ToPointer(),
AugmentCount: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetMetadataItemRequest;
import dev.plexapi.sdk.models.operations.GetMetadataItemResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetMetadataItemRequest req = GetMetadataItemRequest.builder()
.ids(List.of())
.asyncCheckFiles(BoolInt.ONE)
.asyncRefreshLocalMediaAgent(BoolInt.ONE)
.asyncRefreshAnalysis(BoolInt.ONE)
.checkFiles(BoolInt.ONE)
.skipRefresh(BoolInt.ONE)
.checkFileAvailability(BoolInt.ONE)
.asyncAugmentMetadata(BoolInt.ONE)
.augmentCount(BoolInt.ONE)
.build();
GetMetadataItemResponse res = sdk.content().getMetadataItem()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.content.getMetadataItem({
ids: [],
asyncCheckFiles: BoolInt.One,
asyncRefreshLocalMediaAgent: BoolInt.One,
asyncRefreshAnalysis: BoolInt.One,
checkFiles: BoolInt.One,
skipRefresh: BoolInt.One,
checkFileAvailability: BoolInt.One,
asyncAugmentMetadata: BoolInt.One,
augmentCount: BoolInt.One,
});
console.log(result);
}
run();
put:
summary: Edit a metadata item
operationId: editMetadataItem
description: Edit metadata items setting fields
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: array
items:
type: string
- name: args
description: The new values for the metadata item
in: query
schema:
type: object
responses:
'200':
$ref: '#/components/responses/200'
'400':
description: Media items could not be deleted
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.EditMetadataItem(ctx, operations.EditMetadataItemRequest{
Ids: []string{
"",
"",
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.EditMetadataItemRequest;
import dev.plexapi.sdk.models.operations.EditMetadataItemResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
EditMetadataItemRequest req = EditMetadataItemRequest.builder()
.ids(List.of(
"",
""))
.build();
EditMetadataItemResponse res = sdk.library().editMetadataItem()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.editMetadataItem({
ids: [
"",
"",
],
});
console.log(result);
}
run();
/library/metadata/{ids}/addetect:
put:
summary: Ad-detect an item
operationId: detectAds
description: Start the detection of ads in a metadata item
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.DetectAds(ctx, operations.DetectAdsRequest{
Ids: "",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.DetectAdsRequest;
import dev.plexapi.sdk.models.operations.DetectAdsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
DetectAdsRequest req = DetectAdsRequest.builder()
.ids("")
.build();
DetectAdsResponse res = sdk.library().detectAds()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.detectAds({
ids: "",
});
console.log(result);
}
run();
/library/metadata/{ids}/allLeaves:
get:
summary: Get the leaves of an item
operationId: getAllItemLeaves
description: Get the leaves for a metadata item such as the episodes in a show
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetAllItemLeaves(ctx, operations.GetAllItemLeavesRequest{
Ids: "",
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetAllItemLeavesRequest;
import dev.plexapi.sdk.models.operations.GetAllItemLeavesResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetAllItemLeavesRequest req = GetAllItemLeavesRequest.builder()
.ids("")
.build();
GetAllItemLeavesResponse res = sdk.library().getAllItemLeaves()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getAllItemLeaves({
ids: "",
});
console.log(result);
}
run();
/library/metadata/{ids}/analyze:
put:
summary: Analyze an item
operationId: analyzeMetadata
description: Start the analysis of a metadata item
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
- name: thumbOffset
description: Set the offset to be used for thumbnails
in: query
required: false
schema:
type: number
- name: artOffset
description: Set the offset to be used for artwork
in: query
required: false
schema:
type: number
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.AnalyzeMetadata(ctx, operations.AnalyzeMetadataRequest{
Ids: "",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.AnalyzeMetadataRequest;
import dev.plexapi.sdk.models.operations.AnalyzeMetadataResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
AnalyzeMetadataRequest req = AnalyzeMetadataRequest.builder()
.ids("")
.build();
AnalyzeMetadataResponse res = sdk.library().analyzeMetadata()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.analyzeMetadata({
ids: "",
});
console.log(result);
}
run();
/library/metadata/{ids}/chapterThumbs:
put:
summary: Generate thumbs of chapters for an item
operationId: generateThumbs
description: Start the chapter thumb generation for an item
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
- name: force
in: query
required: false
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GenerateThumbs(ctx, operations.GenerateThumbsRequest{
Ids: "",
Force: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GenerateThumbsRequest;
import dev.plexapi.sdk.models.operations.GenerateThumbsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GenerateThumbsRequest req = GenerateThumbsRequest.builder()
.ids("")
.force(BoolInt.ONE)
.build();
GenerateThumbsResponse res = sdk.library().generateThumbs()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.generateThumbs({
ids: "",
force: BoolInt.One,
});
console.log(result);
}
run();
/library/metadata/{ids}/credits:
put:
summary: Credit detect a metadata item
operationId: detectCredits
description: Start credit detection on a metadata item
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
- name: force
in: query
required: false
schema:
$ref: "#/components/schemas/BoolInt"
- name: manual
in: query
required: false
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.DetectCredits(ctx, operations.DetectCreditsRequest{
Ids: "",
Force: components.BoolIntOne.ToPointer(),
Manual: components.BoolIntOne.ToPointer(),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.DetectCreditsRequest;
import dev.plexapi.sdk.models.operations.DetectCreditsResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import dev.plexapi.sdk.models.shared.BoolInt;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
DetectCreditsRequest req = DetectCreditsRequest.builder()
.ids("")
.force(BoolInt.ONE)
.manual(BoolInt.ONE)
.build();
DetectCreditsResponse res = sdk.library().detectCredits()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts, BoolInt } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.detectCredits({
ids: "",
force: BoolInt.One,
manual: BoolInt.One,
});
console.log(result);
}
run();
/library/metadata/{ids}/extras:
get:
summary: Get an item's extras
operationId: getExtras
description: Get the extras for a metadata item
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
responses:
'200':
description: OK
headers:
X-Plex-Container-Start:
description: Provided on all MediaContainer objects indicating the offset of where this container page starts
schema:
type: integer
X-Plex-Container-Total-Size:
description: Provided on all MediaContainer objects indicating the total size of objects available
schema:
type: integer
content:
application/json:
schema:
$ref: '#/components/schemas/MediaContainerWithMetadata'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetExtras(ctx, operations.GetExtrasRequest{
Ids: "",
})
if err != nil {
log.Fatal(err)
}
if res.MediaContainerWithMetadata != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetExtrasRequest;
import dev.plexapi.sdk.models.operations.GetExtrasResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetExtrasRequest req = GetExtrasRequest.builder()
.ids("")
.build();
GetExtrasResponse res = sdk.library().getExtras()
.request(req)
.call();
if (res.mediaContainerWithMetadata().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getExtras({
ids: "",
});
console.log(result);
}
run();
post:
summary: Add to an item's extras
operationId: addExtras
description: Add an extra to a metadata item
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
- name: extraType
description: The metadata type of the extra
in: query
schema:
type: integer
- name: url
description: The URL of the extra
in: query
required: true
schema:
type: string
- $ref: '#/components/parameters/title'
responses:
'200':
$ref: '#/components/responses/200'
'404':
description: Either the metadata item is not present or the extra could not be added
content:
text/html: {}
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.AddExtras(ctx, operations.AddExtrasRequest{
Ids: "",
URL: "https://super-mortise.biz/",
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.AddExtrasRequest;
import dev.plexapi.sdk.models.operations.AddExtrasResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
AddExtrasRequest req = AddExtrasRequest.builder()
.ids("")
.url("https://super-mortise.biz/")
.build();
AddExtrasResponse res = sdk.library().addExtras()
.request(req)
.call();
// handle response
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.addExtras({
ids: "",
url: "https://super-mortise.biz/",
});
console.log(result);
}
run();
/library/metadata/{ids}/file:
get:
summary: Get a file from a metadata or media bundle
operationId: getFile
description: Get a bundle file for a metadata or media item. This is either an image or a mp3 (for a show's theme)
tags:
- Library
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
- name: url
description: The bundle url, typically starting with `metadata://` or `media://`
in: query
schema:
type: string
responses:
'200':
description: OK
content:
audio/mpeg3:
schema:
format: binary
type: string
image/jpeg:
schema:
format: binary
type: string
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.GetFile(ctx, operations.GetFileRequest{
Ids: "",
})
if err != nil {
log.Fatal(err)
}
if res.TwoHundredAudioMpeg3ResponseStream != nil {
// handle response
}
}
- lang: java
label: PlexJava
source: |-
package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.GetFileRequest;
import dev.plexapi.sdk.models.operations.GetFileResponse;
import dev.plexapi.sdk.models.shared.Accepts;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
PlexAPI sdk = PlexAPI.builder()
.accepts(Accepts.APPLICATION_XML)
.clientIdentifier("abc123")
.product("Plex for Roku")
.version("2.4.1")
.platform("Roku")
.platformVersion("4.3 build 1057")
.device("Roku 3")
.model("4200X")
.deviceVendor("Roku")
.deviceName("Living Room TV")
.marketplace("googlePlay")
.token(System.getenv().getOrDefault("TOKEN", ""))
.build();
GetFileRequest req = GetFileRequest.builder()
.ids("")
.build();
GetFileResponse res = sdk.library().getFile()
.request(req)
.call();
if (res.twoHundredAudioMpeg3ResponseStream().isPresent()) {
// handle response
}
}
}
- lang: typescript
label: PlexJS
source: |-
import { PlexAPI } from "@lukehagar/plexjs";
import { Accepts } from "@lukehagar/plexjs/sdk/models/shared";
const plexAPI = new PlexAPI({
accepts: Accepts.ApplicationXml,
clientIdentifier: "abc123",
product: "Plex for Roku",
version: "2.4.1",
platform: "Roku",
platformVersion: "4.3 build 1057",
device: "Roku 3",
model: "4200X",
deviceVendor: "Roku",
deviceName: "Living Room TV",
marketplace: "googlePlay",
});
async function run() {
const result = await plexAPI.library.getFile({
ids: "",
});
console.log(result);
}
run();
/library/metadata/{ids}/index:
put:
summary: Start BIF generation of an item
operationId: startBifGeneration
description: Start the indexing (BIF generation) of an item
tags:
- Library
security:
- token:
- admin
parameters:
- $ref: "#/components/parameters/accepts"
- $ref: "#/components/parameters/X-Plex-Client-Identifier"
- $ref: "#/components/parameters/X-Plex-Product"
- $ref: "#/components/parameters/X-Plex-Version"
- $ref: "#/components/parameters/X-Plex-Platform"
- $ref: "#/components/parameters/X-Plex-Platform-Version"
- $ref: "#/components/parameters/X-Plex-Device"
- $ref: "#/components/parameters/X-Plex-Model"
- $ref: "#/components/parameters/X-Plex-Device-Vendor"
- $ref: "#/components/parameters/X-Plex-Device-Name"
- $ref: "#/components/parameters/X-Plex-Marketplace"
- name: ids
in: path
required: true
schema:
type: string
- name: force
in: query
required: false
schema:
$ref: "#/components/schemas/BoolInt"
responses:
'200':
$ref: '#/components/responses/200'
x-codeSamples:
- lang: go
label: PlexGO
source: |-
package main
import(
"context"
"github.com/LukeHagar/plexgo/models/components"
"github.com/LukeHagar/plexgo"
"github.com/LukeHagar/plexgo/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithAccepts(components.AcceptsApplicationXML),
plexgo.WithClientIdentifier("abc123"),
plexgo.WithProduct("Plex for Roku"),
plexgo.WithVersion("2.4.1"),
plexgo.WithPlatform("Roku"),
plexgo.WithPlatformVersion("4.3 build 1057"),
plexgo.WithDevice("Roku 3"),
plexgo.WithModel("4200X"),
plexgo.WithDeviceVendor("Roku"),
plexgo.WithDeviceName("Living Room TV"),
plexgo.WithMarketplace("googlePlay"),
plexgo.WithSecurity(""),
)
res, err := s.Library.StartBifGeneration(ctx, operations.StartBifGenerationRequest{
Ids: "