PlexGO
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.DVRs.ListDVRs(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.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
}
}
}import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
token: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await plexAPI.dvRs.listDVRs();
console.log(result);
}
run();curl --request GET \
--url https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs \
--header 'X-Plex-Token: <api-key>'import requests
url = "https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs"
headers = {"X-Plex-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Plex-Token': '<api-key>'}};
fetch('https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Plex-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Plex-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"MediaContainer": {
"MediaContainer": {
"identifier": "<string>",
"offset": 123,
"size": 123,
"totalSize": 123,
"status": 123
},
"DVR": [
{
"Device": [
{
"ChannelMapping": [
{
"channelKey": "<string>",
"deviceIdentifier": "<string>",
"enabled": "<string>",
"lineupIdentifier": "<string>"
}
],
"key": "<string>",
"lastSeenAt": 123,
"make": "<string>",
"model": "<string>",
"modelNumber": "<string>",
"protocol": "<string>",
"sources": "<string>",
"state": "<string>",
"status": "<string>",
"tuners": "<string>",
"uri": "<string>",
"uuid": "<string>"
}
],
"key": "<string>",
"language": "<string>",
"lineup": "<string>",
"uuid": "<string>"
}
]
}
}DVRs
Get DVRs
Get the list of all available DVRs
GET
/
livetv
/
dvrs
PlexGO
package main
import(
"context"
"github.com/LukeHagar/plexgo"
"log"
)
func main() {
ctx := context.Background()
s := plexgo.New(
plexgo.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.DVRs.ListDVRs(ctx)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}package hello.world;
import dev.plexapi.sdk.PlexAPI;
import dev.plexapi.sdk.models.operations.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
}
}
}import { PlexAPI } from "@lukehagar/plexjs";
const plexAPI = new PlexAPI({
token: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await plexAPI.dvRs.listDVRs();
console.log(result);
}
run();curl --request GET \
--url https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs \
--header 'X-Plex-Token: <api-key>'import requests
url = "https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs"
headers = {"X-Plex-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Plex-Token': '<api-key>'}};
fetch('https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Plex-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://{IP-description}.{identifier}.plex.direct:{port}/livetv/dvrs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Plex-Token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"MediaContainer": {
"MediaContainer": {
"identifier": "<string>",
"offset": 123,
"size": 123,
"totalSize": 123,
"status": 123
},
"DVR": [
{
"Device": [
{
"ChannelMapping": [
{
"channelKey": "<string>",
"deviceIdentifier": "<string>",
"enabled": "<string>",
"lineupIdentifier": "<string>"
}
],
"key": "<string>",
"lastSeenAt": 123,
"make": "<string>",
"model": "<string>",
"modelNumber": "<string>",
"protocol": "<string>",
"sources": "<string>",
"state": "<string>",
"status": "<string>",
"tuners": "<string>",
"uri": "<string>",
"uuid": "<string>"
}
],
"key": "<string>",
"language": "<string>",
"lineup": "<string>",
"uuid": "<string>"
}
]
}
}Authorizations
The token which identifies the user accessing the PMS. This can be either:
- A traditional access token obtained from plex.tv
- A JWT token obtained through the JWT authentication flow
JWT tokens provide better security with:
- Short-lived tokens (7 days expiration)
- Public-key cryptography (ED25519)
- Better clock synchronization
- Individual device revocation capability
Response
200 - application/json
OK
Show child attributes
Show child attributes
Was this page helpful?
⌘I