Get All TV Shows
A library, such as movies or TV shows, can contain many items. This API command will return all TV shows for a specific library that is available on the Plex server.
URL
GET http://{ip_address}:32400/library/sections/{id}/all?X-Plex-Token={plex_token}&includeGuids={include_guids}&limit={limit}&{filter}
Parameters
Name | Description |
---|---|
ip_address | The IP address of the Plex Media server. |
plex_token | The Plex token. |
id | The key associated with a TV shows library. This key can be found by calling the Libraries API command and looking for a TV shows library. |
include_guids | (Optional) Returns the GUID values of the online metadata services associated to the media item. |
limit | (Optional) This parameter is an integer that indicates how many items to return in the response. |
filter | (Optional) The filter to apply to the response. |
Return Status
HTTP Code | Description |
---|---|
200 | Success - The request was successful. |
401 | Unauthorized - The Plex token provided was not valid. |
Response
XML string value that lists the all the TV shows in the library. An example of the XML returned from the request is shown below:
<?xml version="1.0" encoding="UTF-8"?> <MediaContainer size="11" allowSync="1" art="/:/resources/show-fanart.jpg" identifier="com.plexapp.plugins.library" librarySectionID="4" librarySectionTitle="TV Shows" librarySectionUUID="3bbbe6f7-628f-4983-ae5d-7c05779c4c28" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1641342384" nocache="1" thumb="/:/resources/show.png" title1="TV Shows" title2="All Shows" viewGroup="show" viewMode="65592"> <Directory ratingKey="1161" key="/library/metadata/1161/children" guid="com.plexapp.agents.thetvdb://74205?lang=en" studio="HBO" type="show" title="Band of Brothers" contentRating="TV-MA" summary="The miniseries follows Easy Company, an army unit during World War II, from their initial training at Camp Toccoa to the conclusion of the war. The series is based on the book written by the late Stephen E. Ambrose. Band of Brothers is executive produced by Steven Spielberg and Tom Hanks, the series won 6 Emmy Awards. " index="1" rating="9.5" viewCount="14" lastViewedAt="1468515134" year="2001" thumb="/library/metadata/1161/thumb/1487294876" art="/library/metadata/1161/art/1487294876" banner="/library/metadata/1161/banner/1487294876" theme="/library/metadata/1161/theme/1487294876" duration="3600000" originallyAvailableAt="2001-09-09" leafCount="10" viewedLeafCount="10" childCount="1" addedAt="1420683142" updatedAt="1487294876"> <Genre tag="Action" /> <Genre tag="Adventure" /> <Role tag="Ron Livingston" /> <Role tag="Damian Lewis" /> <Role tag="Matthew Settle" /> </Directory> ... </MediaContainer>
The XML returned provides a list of the all TV shows in a library that are available on the Plex server. The root is the MediaContainer
element. This element contains a few attributes that provide overall information about the TV shows on the server.
Attribute | Description |
---|---|
size | The number of TV shows. |
allowSync | 1 - allow syncing content. 0 - don't allow syncing content. |
art | Background artwork used to represent the TV show. |
identifier | The type of item. |
librarySectionID | The unique key associated with the library. |
librarySectionTitle | The title of the library. |
librarySectionUUID | Unique GUID identifier for the library. |
mediaTagPrefix | Prefix for the media tag. |
mediaTagVersion | Media tag version. Note: This could be a date and time value. |
nocache | 1 - cache the library. 0 - do not cache the library. |
thumb | The thumbnail for the TV show. |
title1 | The title of the TV show. Note: This appears to be internally created, and can't be changed by the server owner. |
title2 | A descriptive title for the TV show. |
viewGroup | The group type used to view the TV show. |
viewMode | Unknown integer value. |
Within the MediaContainer
there are one or more Directory
child elements. Each Directory
element represents one TV show series available on the Plex server.
Attribute | Description |
---|---|
ratingKey | A key associated with the TV show. |
key | The relative URL of the information for the TV show. |
guid | The unique identifier for the TV show. |
studio | The name of the studio that created the TV show. |
title | The name of the TV show. |
contentRating | The content rating associated with the TV show. |
summary | Information about the TV show. |
index | Unknown. |
rating | The rating for the TV show. |
viewCount | The number of times the TV show was viewed. |
lastViewedAt | The date and time the TV show was last viewed. |
year | The year the TV show was released. |
thumb | The thumbnail for the TV show. |
art | The background artwork used to represent the TV show. |
banner | The banner artwork use to represent the TV show. |
theme | The musical theme for the TV show. |
duration | The length of the in milliseconds.. |
originallyAvailableAt | The original release date of the TV show. |
leafCount | The number of items in the TV show. |
viewedLeafCount | The number of the TV show items that have been viewed. |
childCount | The number of child items. |
addedAt | The date and time the TV show was added to the library. |
updatedAt | The date and time the TV show was updated in the library. |
Also within the Directory
element there are multiple additional child elements that provide more details about the TV show. These child elements include Genre
and Role
.
Within each of these child elements is a single tag
attribute that provides the information for the element. There could be multiple of the same child element within the Directory
, as each TV show can be in multiple genres and list multiple actors.
Attribute | Description |
---|---|
tag | A genre of the TV show. |
Attribute | Description |
---|---|
tag | The name of a person with a role in the TV show. |
If the include_guids
parameter was specified with the value of 1, then there would be a Guid
element for each online metadata service associated with the item.
Remarks
The limit
can be used to specify the number of items to return in the response.
To reduce the number of items returned, you can filter the API response to only return items that meet a specific criteria.
For more information, check out the Filter page.
Examples
curl -X GET http://{ip_address}:32400/library/sections/{id}/all?X-Plex-Token={plex_token}
import requests plex_url = http://{ip_address}:32400/library/sections/{id}/all?X-Plex-Token={plex_token} response = requests.get(plex_url) print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/library/sections/{id}/all?X-Plex-Token={plex_token}' -Method 'GET' Write-Output $response