* `plex_api.library_playlists.add_playlist_items()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.hubs.get_metadata_hubs()`: * `request.only_transient` **Changed** * `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_collections.move_collection_item()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_collections.delete_collection_item()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_collections.add_collection_items()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.content.get_sonically_similar()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.butler.stop_task()`: `request` **Changed** **Breaking** ⚠️ * `plex_api.butler.start_task()`: `request` **Changed** **Breaking** ⚠️ * `plex_api.content.get_sonic_path()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.download_queue.get_item_decision()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.hubs.get_all_hubs()`: * `request.only_transient` **Changed** * `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.hubs.get_continue_watching()`: `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.hubs.get_promoted_hubs()`: `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.content.get_all_leaves()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.hubs.get_postplay_hubs()`: * `request.only_transient` **Changed** * `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.hubs.get_related_hubs()`: * `request.only_transient` **Changed** * `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.hubs.get_section_hubs()`: * `request.only_transient` **Changed** * `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.content.list_content()`: * `request` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.content.get_albums()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.search.search_hubs()`: `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.search.voice_search_hubs()`: * `request.type` **Changed** **Breaking** ⚠️ * `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_library_items()`: * `request.media_query` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.ingest_transient_item()`: * `request` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_library_matches()`: * `request` **Changed** **Breaking** ⚠️ * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.content.get_metadata_item()`: * `request` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_sections()`: `response.media_container.directory.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.add_section()`: * `request` **Changed** * `response.media_container.directory.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_tags()`: * `request.type` **Changed** **Breaking** ⚠️ * `plex_api.content.get_collection_items()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_all_item_leaves()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.status.list_sessions()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.move_play_queue_item()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_extras()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.delete_play_queue_item()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.unshuffle()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.list_matches()`: * `request.manual` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.list_sonically_similar()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.reset_play_queue()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_related_items()`: `response.media_container.hub.[].metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.list_similar()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.clear_play_queue()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_item_tree()`: `response.media_container.metadata_item.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.add_to_play_queue()`: * `request.next` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.get_play_queue()`: * `request` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_playlists.move_playlist_item()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_person()`: `response.media_container.directory.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.list_person_media()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_playlists.get_playlist_generator_items()`: `response.media_container.metadata` **Changed** **Breaking** ⚠️ * `plex_api.library.get_library_details()`: * `request.include_details` **Changed** * `response.media_container.directory.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_playlists.modify_playlist_generator()`: * `request.item` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.autocomplete()`: * `request.media_query` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_collections()`: * `request.media_query` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.get_common()`: * `request.media_query` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_playlists.delete_playlist_item()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_playlists.clear_playlist_items()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.play_queue.shuffle()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library_playlists.create_playlist()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.playlist.get_playlist_items()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.playlist.get_playlist()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.collections.create_collection()`: * `request.type` **Changed** **Breaking** ⚠️ * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.dv_rs.tune_channel()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.live_tv.get_sessions()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.live_tv.get_live_tv_session()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.playlist.list_playlists()`: `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.subscriptions.get_all_subscriptions()`: * `request` **Changed** * `response.media_container.media_subscription.[].media_grab_operation.[].metadata` **Changed** **Breaking** ⚠️ * `plex_api.subscriptions.create_subscription()`: `response.media_container.media_subscription.[].media_grab_operation.[].metadata` **Changed** **Breaking** ⚠️ * `plex_api.subscriptions.get_scheduled_recordings()`: `response.media_container.media_grab_operation.[].metadata` **Changed** **Breaking** ⚠️ * `plex_api.subscriptions.get_template()`: `response.media_container.subscription_template.[].media_subscription.[].media_grab_operation.[].metadata` **Changed** **Breaking** ⚠️ * `plex_api.subscriptions.get_subscription()`: * `request` **Changed** * `response.media_container.media_subscription.[].media_grab_operation.[].metadata` **Changed** **Breaking** ⚠️ * `plex_api.subscriptions.edit_subscription_preferences()`: `response.media_container.media_subscription.[].media_grab_operation.[].metadata` **Changed** **Breaking** ⚠️ * `plex_api.subscriptions.reorder_subscription()`: `response.media_container.media_subscription.[].media_grab_operation.[].metadata` **Changed** **Breaking** ⚠️ * `plex_api.transcoder.make_decision()`: * `request` **Changed** * `response.media_container.metadata.[]` **Changed** **Breaking** ⚠️ * `plex_api.library.refresh_items_metadata()`: * `request.mark_updated` **Changed** * `plex_api.authentication.post-users-sign-in-data()`: **Added** * `plex_api.transcoder.start_transcode_session()`: `request` **Changed** * `plex_api.devices.modify_device()`: * `request.enabled` **Changed** * `plex_api.library.get_media_part()`: * `request.download` **Changed** * `plex_api.library.detect_intros()`: * `request.force` **Changed** * `plex_api.library.refresh_section()`: * `request.force` **Changed** * `plex_api.library_playlists.upload_playlist()`: * `request.force` **Changed** * `plex_api.library.delete_media_item()`: * `request.proxy` **Changed** * `plex_api.authentication.get_token_details()`: **Added** * `plex_api.library.get_first_characters()`: * `request.media_query` **Changed** * `plex_api.library.update_items()`: * `request.field.locked` **Changed** * `plex_api.library.delete_library_section()`: * `request.async` **Changed** * `plex_api.library.set_stream_selection()`: * `request.all_parts` **Changed** * `plex_api.play_queue.create_play_queue()`: `request` **Changed** * `plex_api.library.get_augmentation_status()`: * `request.wait` **Changed** * `plex_api.library.detect_voice_activity()`: `request` **Changed** * `plex_api.transcoder.transcode_image()`: `request` **Changed** * `plex_api.transcoder.transcode_subtitles()`: `request` **Changed** * `plex_api.library.add_subtitles()`: `request` **Changed** * `plex_api.library.get_stream()`: * `request.auto_adjust_subtitle` **Changed** * `plex_api.library.start_bif_generation()`: * `request.force` **Changed** * `plex_api.library.detect_credits()`: `request` **Changed** * `plex_api.ultra_blur.get_image()`: * `request.noise` **Changed** * `plex_api.library.generate_thumbs()`: * `request.force` **Changed** * `plex_api.updater.apply_updates()`: `request` **Changed** * `plex_api.updater.check_updates()`: * `request.download` **Changed** * `plex_api.library.delete_metadata_item()`: * `request.proxy` **Changed** * `plex_api.library.optimize_database()`: * `request.async` **Changed** * `plex_api.hubs.update_hub_visibility()`: `request` **Changed** * `plex_api.hubs.create_custom_hub()`: `request` **Changed** * `plex_api.library.get_section_image()`: * `request.media_query` **Changed** * `plex_api.download_queue.add_download_queue_items()`: `request` **Changed** * `plex_api.timeline.report()`: `request` **Changed** * `plex_api.general.get_source_connection_information()`: * `request.refresh` **Changed** * `plex_api.plex.get-server-resources()`: **Added** * `plex_api.users.get-users()`: **Added**
Library
(library)
Overview
Library endpoints which are outside of the Media Provider API. Typically this is manipulation of the library (adding/removing sections, modifying preferences, etc).
Available Operations
- get_library_items - Get all items in library
- delete_caches - Delete library caches
- clean_bundles - Clean bundles
- ingest_transient_item - Ingest a transient item
- get_library_matches - Get library matches
- optimize_database - Optimize the Database
- get_random_artwork - Get random artwork
- get_sections - Get library sections (main Media Provider Only)
- add_section - Add a library section
- stop_all_refreshes - Stop refresh
- get_sections_prefs - Get section prefs
- refresh_sections_metadata - Refresh all sections
- get_tags - Get all library tags of a type
- delete_metadata_item - Delete a metadata item
- edit_metadata_item - Edit a metadata item
- detect_ads - Ad-detect an item
- get_all_item_leaves - Get the leaves of an item
- analyze_metadata - Analyze an item
- generate_thumbs - Generate thumbs of chapters for an item
- detect_credits - Credit detect a metadata item
- get_extras - Get an item's extras
- add_extras - Add to an item's extras
- get_file - Get a file from a metadata or media bundle
- start_bif_generation - Start BIF generation of an item
- detect_intros - Intro detect an item
- create_marker - Create a marker
- match_item - Match a metadata item
- list_matches - Get metadata matches for an item
- merge_items - Merge a metadata item
- list_sonically_similar - Get nearest tracks to metadata item
- set_item_preferences - Set metadata preferences
- refresh_items_metadata - Refresh a metadata item
- get_related_items - Get related items
- list_similar - Get similar items
- split_item - Split a metadata item
- add_subtitles - Add subtitles
- get_item_tree - Get metadata items as a tree
- unmatch - Unmatch a metadata item
- list_top_users - Get metadata top users
- detect_voice_activity - Detect voice activity
- get_augmentation_status - Get augmentation status
- set_stream_selection - Set stream selection
- get_person - Get person details
- list_person_media - Get media for a person
- delete_library_section - Delete a library section
- get_library_details - Get a library section by id
- edit_section - Edit a library section
- update_items - Set the fields of the filtered items
- start_analysis - Analyze a section
- autocomplete - Get autocompletions for search
- get_collections - Get collections in a section
- get_common - Get common fields for items
- empty_trash - Empty section trash
- get_section_filters - Get section filters
- get_first_characters - Get list of first characters
- delete_indexes - Delete section indexes
- delete_intros - Delete section intro markers
- get_section_preferences - Get section prefs
- set_section_preferences - Set section prefs
- cancel_refresh - Cancel section refresh
- refresh_section - Refresh section
- get_available_sorts - Get a section sorts
- get_stream_levels - Get loudness about a stream in json
- get_stream_loudness - Get loudness about a stream
- get_chapter_image - Get a chapter image
- set_item_artwork - Set an item's artwork, theme, etc
- update_item_artwork - Set an item's artwork, theme, etc
- delete_marker - Delete a marker
- edit_marker - Edit a marker
- delete_media_item - Delete a media item
- get_part_index - Get BIF index for a part
- delete_collection - Delete a collection
- get_section_image - Get a section composite image
- delete_stream - Delete a stream
- get_stream - Get a stream
- set_stream_offset - Set a stream offset
- get_item_artwork - Get an item's artwork, theme, etc
- get_media_part - Get a media part
- get_image_from_bif - Get an image from part BIF
get_library_items
Request all metadata items according to a query.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_library_items(request={
"media_query": {
"type": components.MediaType.EPISODE,
"source_type": 2,
"sort": "duration:desc,index",
},
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetLibraryItemsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetLibraryItemsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_caches
Delete the hub caches so they are recomputed on next request
Example Usage
from plex_api_client import PlexAPI
with PlexAPI(
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_caches()
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteCachesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
clean_bundles
Clean out any now unused bundles. Bundles can become unused when media is deleted
Example Usage
from plex_api_client import PlexAPI
with PlexAPI(
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.clean_bundles()
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.CleanBundlesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
ingest_transient_item
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.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.ingest_transient_item(request=operations.IngestTransientItemRequest(
url="file:///storage%2Femulated%2F0%2FArcher-S01E01.mkv",
virtual_file_path="/Avatar.mkv",
compute_hashes=components.BoolInt.TRUE,
ingest_non_matches=components.BoolInt.TRUE,
))
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.IngestTransientItemRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.IngestTransientItemResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_library_matches
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
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_library_matches(request=operations.GetLibraryMatchesRequest(
type=components.MediaType.TV_SHOW,
include_full_metadata=components.BoolInt.TRUE,
include_ancestor_metadata=components.BoolInt.TRUE,
include_alternate_metadata_sources=components.BoolInt.TRUE,
))
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetLibraryMatchesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetLibraryMatchesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
optimize_database
Initiate optimize on the database.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.optimize_database(request={
"async_": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.OptimizeDatabaseRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.OptimizeDatabaseResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_random_artwork
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.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_random_artwork(request={
"sections": [
5,
6,
],
})
assert res.media_container_with_artwork is not None
# Handle response
print(res.media_container_with_artwork)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetRandomArtworkRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetRandomArtworkResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_sections
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).
Example Usage
from plex_api_client import PlexAPI
with PlexAPI(
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_sections()
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetSectionsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
add_section
Add a new library section to the server
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.add_section(request=operations.AddSectionRequest(
name="<value>",
type=39544,
agent="<value>",
language="<value>",
locations=[
"O:\fatboy\\Media\\Ripped\\Music",
"O:\fatboy\\Media\\My Music",
],
prefs=operations.QueryParamPrefs(),
relative=components.BoolInt.TRUE,
import_fromi_tunes=components.BoolInt.TRUE,
))
assert res.slash_get_responses_200 is not None
# Handle response
print(res.slash_get_responses_200)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AddSectionRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
stop_all_refreshes
Stop all refreshes across all sections
Example Usage
from plex_api_client import PlexAPI
with PlexAPI(
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.stop_all_refreshes()
assert res.library_sections is not None
# Handle response
print(res.library_sections)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.StopAllRefreshesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_sections_prefs
Get a section's preferences for a metadata type
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_sections_prefs(request={
"type": 460221,
})
assert res.library_sections is not None
# Handle response
print(res.library_sections)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetSectionsPrefsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetSectionsPrefsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
refresh_sections_metadata
Tell PMS to refresh all section metadata
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.refresh_sections_metadata(request={})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.RefreshSectionsMetadataRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.RefreshSectionsMetadataResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_tags
Get all library tags of a type
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_tags(request={
"type": components.MediaType.TV_SHOW,
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetTagsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_metadata_item
Delete a single metadata item from the library, deleting media as well
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_metadata_item(request={
"ids": "<value>",
"proxy": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteMetadataItemRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteMetadataItemResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
edit_metadata_item
Edit metadata items setting fields
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.edit_metadata_item(request={
"ids": [
"<value 1>",
"<value 2>",
],
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.EditMetadataItemRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.EditMetadataItemResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
detect_ads
Start the detection of ads in a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.detect_ads(request={
"ids": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DetectAdsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_all_item_leaves
Get the leaves for a metadata item such as the episodes in a show
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_all_item_leaves(request={
"ids": "<value>",
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetAllItemLeavesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetAllItemLeavesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
analyze_metadata
Start the analysis of a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.analyze_metadata(request={
"ids": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AnalyzeMetadataRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.AnalyzeMetadataResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
generate_thumbs
Start the chapter thumb generation for an item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.generate_thumbs(request={
"ids": "<value>",
"force": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GenerateThumbsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GenerateThumbsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
detect_credits
Start credit detection on a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.detect_credits(request=operations.DetectCreditsRequest(
ids="<value>",
force=components.BoolInt.TRUE,
manual=components.BoolInt.TRUE,
))
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DetectCreditsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DetectCreditsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_extras
Get the extras for a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_extras(request={
"ids": "<value>",
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetExtrasRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
add_extras
Add an extra to a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.add_extras(request={
"ids": "<value>",
"url": "https://super-mortise.biz/",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AddExtrasRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_file
Get a bundle file for a metadata or media item. This is either an image or a mp3 (for a show's theme)
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_file(request={
"ids": "<value>",
})
assert res.two_hundred_audio_mpeg3_response_stream is not None
# Handle response
print(res.two_hundred_audio_mpeg3_response_stream)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetFileRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
start_bif_generation
Start the indexing (BIF generation) of an item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.start_bif_generation(request={
"ids": "<value>",
"force": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.StartBifGenerationRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.StartBifGenerationResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
detect_intros
Start the detection of intros in a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.detect_intros(request={
"ids": "<value>",
"force": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DetectIntrosRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DetectIntrosResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
create_marker
Create a marker for this user on the metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.create_marker(request={
"ids": "<value>",
"type": 248391,
"start_time_offset": 535191,
"attributes": {},
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CreateMarkerRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.CreateMarkerResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
match_item
Match a metadata item to a guid
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.match_item(request={
"ids": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.MatchItemRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
list_matches
Get the list of metadata matches for a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.list_matches(request={
"ids": "<value>",
"manual": components.BoolInt.TRUE,
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListMatchesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.ListMatchesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
merge_items
Merge a metadata item with other items
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.merge_items(request={
"ids_path_parameter": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.MergeItemsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
list_sonically_similar
Get the nearest tracks, sonically, to the provided track
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.list_sonically_similar(request={
"ids": "<value>",
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListSonicallySimilarRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.ListSonicallySimilarResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
set_item_preferences
Set the preferences on a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.set_item_preferences(request={
"ids": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SetItemPreferencesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.SetItemPreferencesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
refresh_items_metadata
Refresh a metadata item from the agent
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.refresh_items_metadata(request={
"ids": "<value>",
"mark_updated": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.RefreshItemsMetadataRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.RefreshItemsMetadataResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_related_items
Get a hub of related items to a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_related_items(request={
"ids": "<value>",
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetRelatedItemsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetRelatedItemsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
list_similar
Get a list of similar items to a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.list_similar(request={
"ids": "<value>",
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListSimilarRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.ListSimilarResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
split_item
Split a metadata item into multiple items
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.split_item(request={
"ids": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SplitItemRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
add_subtitles
Add a subtitle to a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.add_subtitles(request=operations.AddSubtitlesRequest(
ids="<value>",
forced=components.BoolInt.TRUE,
hearing_impaired=components.BoolInt.TRUE,
))
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AddSubtitlesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.AddSubtitlesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_item_tree
Get a tree of metadata items, such as the seasons/episodes of a show
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_item_tree(request={
"ids": "<value>",
})
assert res.media_container_with_nested_metadata is not None
# Handle response
print(res.media_container_with_nested_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetItemTreeRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetItemTreeResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
unmatch
Unmatch a metadata item to info fetched from the agent
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.unmatch(request={
"ids": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UnmatchRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
list_top_users
Get the list of users which have played this item starting with the most
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.list_top_users(request={
"ids": "<value>",
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListTopUsersRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.ListTopUsersResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
detect_voice_activity
Start the detection of voice in a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.detect_voice_activity(request=operations.DetectVoiceActivityRequest(
ids="<value>",
force=components.BoolInt.TRUE,
manual=components.BoolInt.TRUE,
))
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DetectVoiceActivityRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DetectVoiceActivityResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_augmentation_status
Get augmentation status and potentially wait for completion
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_augmentation_status(request={
"augmentation_id": "<id>",
"wait": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetAugmentationStatusRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetAugmentationStatusResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
set_stream_selection
Set which streams (audio/subtitle) are selected by this user
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.set_stream_selection(request={
"part_id": 360489,
"all_parts": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SetStreamSelectionRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.SetStreamSelectionResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_person
Get details for a single actor.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_person(request={
"person_id": "<id>",
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetPersonRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
list_person_media
Get all the media for a single actor.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.list_person_media(request={
"person_id": "<id>",
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.ListPersonMediaRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.ListPersonMediaResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_library_section
Delete a library section by id
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_library_section(request={
"section_id": "<id>",
"async_": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteLibrarySectionRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteLibrarySectionResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_library_details
Returns details for the library. This can be thought of as an interstitial endpoint because it contains information about the library, rather than content itself. It often contains a list of Directory metadata objects: These used to be used by clients to build a menuing system.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_library_details(request={
"section_id": "<id>",
"include_details": components.BoolInt.TRUE,
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetLibraryDetailsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetLibraryDetailsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
edit_section
Edit a library section by id setting parameters
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.edit_section(request={
"section_id": "<id>",
"agent": "<value>",
"locations": [
"O:\fatboy\\Media\\Ripped\\Music",
"O:\fatboy\\Media\\My Music",
],
"prefs": {},
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.EditSectionRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.EditSectionResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
update_items
This endpoint takes an large possible set of values. Here are some examples.
-
Parameters, extra documentation
- artist.title.value
- When used with track, both artist.title.value and album.title.value need to be specified
- title.value usage
- Summary
- Tracks always rename and never merge
- Albums and Artists
- if single item and item without title does not exist, it is renamed.
- if single item and item with title does exist they are merged.
- if multiple they are always merged.
- Tracks
- Works as expected will update the track's title
- Single track:
/library/sections/{id}/all?type=10&id=42&title.value=NewName - Multiple tracks:
/library/sections/{id}/all?type=10&id=42,43,44&title.value=NewName - All tracks:
/library/sections/{id}/all?type=10&title.value=NewName
- Albums
- Functionality changes depending on the existence of an album with the same title
- Album exists
- Single album:
/library/sections/{id}/all?type=9&id=42&title.value=Album 2- Album with id 42 is merged into album titled "Album 2"
- Multiple/All albums:
/library/sections/{id}/all?type=9&title.value=Moo Album- All albums are merged into the existing album titled "Moo Album"
- Single album:
- Album does not exist
- Single album:
/library/sections/{id}/all?type=9&id=42&title.value=NewAlbumTitle- Album with id 42 has title modified to "NewAlbumTitle"
- Multiple/All albums:
/library/sections/{id}/all?type=9&title.value=NewAlbumTitle- All albums are merged into a new album with title="NewAlbumTitle"
- Single album:
- Artists
- Functionaly changes depending on the existence of an artist with the same title.
- Artist exists
- Single artist:
/library/sections/{id}/all?type=8&id=42&title.value=Artist 2- Artist with id 42 is merged into existing artist titled "Artist 2"
- Multiple/All artists:
/library/sections/{id}/all?type=8&title.value=Artist 3- All artists are merged into the existing artist titled "Artist 3"
- Single artist:
- Artist does not exist
- Single artist:
/library/sections/{id}/all?type=8&id=42&title.value=NewArtistTitle- Artist with id 42 has title modified to "NewArtistTitle"
- Multiple/All artists:
/library/sections/{id}/all?type=8&title.value=NewArtistTitle- All artists are merged into a new artist with title="NewArtistTitle"
- Single artist:
- Summary
- artist.title.value
-
Notes
- Technically square brackets are not allowed in an URI except the Internet Protocol Literal Address
- RFC3513: A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where square bracket characters are allowed in the URI syntax.
- Escaped square brackets are allowed, but don't render well
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.update_items(request={
"section_id": "<id>",
"field_locked": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateItemsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.UpdateItemsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
start_analysis
Start analysis of all items in a section. If BIF generation is enabled, this will also be started on this section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.start_analysis(request={
"section_id": 158829,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.StartAnalysisRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.StartAnalysisResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
autocomplete
The field to autocomplete on is specified by the {field}.query parameter. For example genre.query or title.query.
Returns a set of items from the filtered items whose {field} starts with {field}.query. In the results, a {field}.queryRange will be present to express the range of the match
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.autocomplete(request={
"section_id": 942007,
"media_query": {
"type": components.MediaType.EPISODE,
"source_type": 2,
"sort": "duration:desc,index",
},
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.AutocompleteRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.AutocompleteResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_collections
Get all collections in a section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_collections(request={
"section_id": 348838,
"media_query": {
"type": components.MediaType.EPISODE,
"source_type": 2,
"sort": "duration:desc,index",
},
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetCollectionsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetCollectionsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_common
Represents a "Common" item. It contains only the common attributes of the items selected by the provided filter
Fields which are not common will be expressed in the mixedFields field
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_common(request={
"section_id": 298154,
"media_query": {
"type": components.MediaType.EPISODE,
"source_type": 2,
"sort": "duration:desc,index",
},
})
assert res.media_container_with_metadata is not None
# Handle response
print(res.media_container_with_metadata)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetCommonRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
empty_trash
Empty trash in the section, permanently deleting media/metadata for missing media
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.empty_trash(request={
"section_id": 30052,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.EmptyTrashRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_section_filters
Get common filters on a section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_section_filters(request={
"section_id": 380557,
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetSectionFiltersRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetSectionFiltersResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_first_characters
Get list of first characters in this section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_first_characters(request={
"section_id": 3947,
"media_query": {
"type": components.MediaType.EPISODE,
"source_type": 2,
"sort": "duration:desc,index",
},
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetFirstCharactersRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetFirstCharactersResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_indexes
Delete all the indexes in a section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_indexes(request={
"section_id": 588437,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteIndexesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteIndexesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_intros
Delete all the intro markers in a section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_intros(request={
"section_id": 498656,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteIntrosRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteIntrosResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_section_preferences
Get the prefs for a section by id and potentially overriding the agent
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_section_preferences(request={
"section_id": 754869,
})
assert res.media_container_with_settings is not None
# Handle response
print(res.media_container_with_settings)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetSectionPreferencesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetSectionPreferencesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
set_section_preferences
Set the prefs for a section by id
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.set_section_preferences(request={
"section_id": 349936,
"prefs": {},
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SetSectionPreferencesRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.SetSectionPreferencesResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
cancel_refresh
Cancel the refresh of a section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.cancel_refresh(request={
"section_id": 326852,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CancelRefreshRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.CancelRefreshResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
refresh_section
Start a refresh of this section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.refresh_section(request={
"section_id": 450300,
"force": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.RefreshSectionRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.RefreshSectionResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_available_sorts
Get the sort mechanisms available in a section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_available_sorts(request={
"section_id": 212498,
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetAvailableSortsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetAvailableSortsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_stream_levels
The the loudness of a stream in db, one entry per 100ms
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_stream_levels(request={
"stream_id": 447611,
})
assert res.object is not None
# Handle response
print(res.object)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetStreamLevelsRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetStreamLevelsResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_stream_loudness
The the loudness of a stream in db, one number per line, one entry per 100ms
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_stream_loudness(request={
"stream_id": 277271,
})
assert res.res is not None
# Handle response
print(res.res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetStreamLoudnessRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetStreamLoudnessResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_chapter_image
Get a single chapter image for a piece of media
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_chapter_image(request={
"media_id": 892563,
"chapter": 48348,
})
assert res.response_stream is not None
# Handle response
print(res.response_stream)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetChapterImageRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetChapterImageResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
set_item_artwork
Set the artwork, thumb, element for a metadata item Generally only the admin can perform this action. The exception is if the metadata is a playlist created by the user
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.set_item_artwork(request={
"ids": "<value>",
"element": operations.Element.BANNER,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SetItemArtworkRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.SetItemArtworkResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
update_item_artwork
Set the artwork, thumb, element for a metadata item Generally only the admin can perform this action. The exception is if the metadata is a playlist created by the user
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.update_item_artwork(request={
"ids": "<value>",
"element": operations.PathParamElement.CLEAR_LOGO,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.UpdateItemArtworkRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.UpdateItemArtworkResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_marker
Delete a marker for this user on the metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_marker(request={
"ids": "<value>",
"marker": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteMarkerRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteMarkerResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
edit_marker
Edit a marker for this user on the metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.edit_marker(request={
"ids": "<value>",
"marker": "<value>",
"type": 884347,
"start_time_offset": 517251,
"attributes": {},
})
assert res.post_responses_200 is not None
# Handle response
print(res.post_responses_200)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.EditMarkerRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_media_item
Delete a single media from a metadata item in the library
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_media_item(request={
"ids": "<value>",
"media_item": "<value>",
"proxy": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteMediaItemRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteMediaItemResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_part_index
Get BIF index for a part by index type
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_part_index(request={
"part_id": 724750,
"index": operations.Index.SD,
})
assert res.response_stream is not None
# Handle response
print(res.response_stream)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetPartIndexRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetPartIndexResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_collection
Delete a library collection from the PMS
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_collection(request={
"section_id": 283619,
"collection_id": 680895,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteCollectionRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteCollectionResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_section_image
Get a composite image of images in this section
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_section_image(request={
"section_id": 925611,
"updated_at": 117413,
"media_query": {
"type": components.MediaType.EPISODE,
"source_type": 2,
"sort": "duration:desc,index",
},
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetSectionImageRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetSectionImageResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
delete_stream
Delete a stream. Only applies to downloaded subtitle streams or a sidecar subtitle when media deletion is enabled.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.delete_stream(request={
"stream_id": 841510,
"ext": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.DeleteStreamRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.DeleteStreamResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_stream
Get a stream (such as a sidecar subtitle stream)
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_stream(request={
"stream_id": 314506,
"ext": "<value>",
"auto_adjust_subtitle": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetStreamRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
set_stream_offset
Set a stream offset in ms. This may not be respected by all clients
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.set_stream_offset(request={
"stream_id": 606295,
"ext": "<value>",
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.SetStreamOffsetRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.SetStreamOffsetResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_item_artwork
Get the artwork, thumb, element for a metadata item
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_item_artwork(request={
"ids": "<value>",
"element": operations.GetItemArtworkPathParamElement.POSTER,
"timestamp": 999555,
})
assert res.two_hundred_audio_mpeg3_response_stream is not None
# Handle response
print(res.two_hundred_audio_mpeg3_response_stream)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetItemArtworkRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetItemArtworkResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_media_part
Get a media part for streaming or download.
- streaming: This is the default scenario. Bandwidth usage on this endpoint will be guaranteed (on the server's end) to be at least the bandwidth reservation given in the decision. If no decision exists, an ad-hoc decision will be created if sufficient bandwidth exists. Clients should not rely on ad-hoc decisions being made as this may be removed in the future.
- download: Indicated if the query parameter indicates this is a download. Bandwidth will be prioritized behind playbacks and will get a fair share of what remains.
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_media_part(request={
"part_id": 877105,
"changestamp": 970622,
"filename": "example.file",
"download": components.BoolInt.TRUE,
})
assert res is not None
# Handle response
print(res)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetMediaPartRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetMediaPartResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
get_image_from_bif
Extract an image from the BIF for a part at a particular offset
Example Usage
from plex_api_client import PlexAPI
from plex_api_client.models import components, operations
with PlexAPI(
accepts=components.Accepts.APPLICATION_XML,
client_identifier="abc123",
product="Plex for Roku",
version="2.4.1",
platform="Roku",
platform_version="4.3 build 1057",
device="Roku 3",
model="4200X",
device_vendor="Roku",
device_name="Living Room TV",
marketplace="googlePlay",
token="<YOUR_API_KEY_HERE>",
) as plex_api:
res = plex_api.library.get_image_from_bif(request={
"part_id": 304273,
"index": operations.PathParamIndex.SD,
"offset": 939569,
})
assert res.response_stream is not None
# Handle response
print(res.response_stream)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.GetImageFromBifRequest | ✔️ | The request object to use for the request. |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Response
operations.GetImageFromBifResponse
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |