Files
plexjs/docs/sdks/server/README.md

32 KiB
Raw Blame History

Server

(server)

Overview

Operations against the Plex Media Server System.

Available Operations

getServerCapabilities

Get Server Capabilities

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getServerCapabilities();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetServerCapabilitiesResponse>

Errors

Error Object Status Code Content Type
models.GetServerCapabilitiesServerResponseBody 401 application/json
models.SDKError 4xx-5xx /

getServerPreferences

Get Server Preferences

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getServerPreferences();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetServerPreferencesResponse>

Errors

Error Object Status Code Content Type
models.GetServerPreferencesServerResponseBody 401 application/json
models.SDKError 4xx-5xx /

getAvailableClients

Get Available Clients

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getAvailableClients();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetAvailableClientsResponse>

Errors

Error Object Status Code Content Type
models.GetAvailableClientsServerResponseBody 401 application/json
models.SDKError 4xx-5xx /

getDevices

Get Devices

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getDevices();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetDevicesResponse>

Errors

Error Object Status Code Content Type
models.GetDevicesServerResponseBody 401 application/json
models.SDKError 4xx-5xx /

getServerIdentity

Get Server Identity

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getServerIdentity();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetServerIdentityResponse>

Errors

Error Object Status Code Content Type
models.GetServerIdentityServerResponseBody 401 application/json
models.SDKError 4xx-5xx /

getMyPlexAccount

Returns MyPlex Account Information

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getMyPlexAccount();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetMyPlexAccountResponse>

Errors

Error Object Status Code Content Type
models.GetMyPlexAccountServerResponseBody 401 application/json
models.SDKError 4xx-5xx /

getResizedPhoto

Plex's Photo transcoder is used throughout the service to serve images at specified sizes.

Example Usage

import { MinSize, PlexAPI, Upscale } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getResizedPhoto({
    width: 110,
    height: 165,
    opacity: 100,
    blur: 20,
    minSize: MinSize.One,
    upscale: Upscale.Zero,
    url: "/library/metadata/49564/thumb/1654258204",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request models.GetResizedPhotoRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetResizedPhotoResponse>

Errors

Error Object Status Code Content Type
models.GetResizedPhotoResponseBody 401 application/json
models.SDKError 4xx-5xx /

getServerList

Get Server List

Example Usage

import { PlexAPI } from "@lukehagar/plexjs";

const plexAPI = new PlexAPI({
  accessToken: "<YOUR_API_KEY_HERE>",
  xPlexClientIdentifier: "Postman",
});

async function run() {
  const result = await plexAPI.server.getServerList();

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<models.GetServerListResponse>

Errors

Error Object Status Code Content Type
models.GetServerListServerResponseBody 401 application/json
models.SDKError 4xx-5xx /