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.
GET http://[IP address]:32400/library/sections/[TV Shows Library ID]/all?X-Plex-Token=[PlexToken]&[Filter]
|IP address||The IP address of the Plex Media server.|
|PlexToken||The authentication Plex token.|
|TV Shows Library 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.|
|Filter||The filter to apply to the response.|
|200||Success - The request was successful.|
|401||Unauthorized - The Plex token provided was not valid.|
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.
|size||The number of TV shows.|
|allowSync||1 - allow syncing content from this library.|
0 - don't allow syncing content from this library.
|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.|
MediaContainer there are one or more
Directory child elements. Each
Directory element represents one TV show series available on the Plex server.
|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.|
|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
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.
|tag||A genre of the TV show.|
|tag||The name of a person with a role in the TV show.|
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.
Get the list of all TV shows from the library associated with ID 4 on the Plex Media Server located at the IP address of 192.168.1.4: