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

Errors

Error Object Status Code Content Type
errors.GetSessionsResponseBody 401 application/json
errors.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<operations.GetSessionHistoryResponse>

Errors

Error Object Status Code Content Type
errors.GetSessionHistoryResponseBody 401 application/json
errors.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<operations.GetTranscodeSessionsResponse>

Errors

Error Object Status Code Content Type
errors.GetTranscodeSessionsResponseBody 401 application/json
errors.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<operations.StopTranscodeSessionResponse>

Errors

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