Files
plexjs/docs/sdks/sessions

Sessions

(sessions)

Overview

API Calls that perform search operations with Plex Media Server Sessions

Available Operations

getSessions

This will retrieve the "Now Playing" Information of the PMS.

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.sessions.getSessions();

  // 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.GetSessionsResponse>

Errors

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

getSessionHistory

This will Retrieve a listing of all history views.

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.sessions.getSessionHistory();

  // 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.GetSessionHistoryResponse>

Errors

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

getTranscodeSessions

Get Transcode Sessions

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.sessions.getTranscodeSessions();

  // 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.GetTranscodeSessionsResponse>

Errors

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

stopTranscodeSession

Stop a Transcode Session

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.sessions.stopTranscodeSession("zz7llzqlx8w9vnrsbnwhbmep");

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

run();

Parameters

Parameter Type Required Description Example
sessionKey string ✔️ the Key of the transcode session to stop [object Object]
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.StopTranscodeSessionResponse>

Errors

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