Get All Photos
A library, such as movies or TV shows, can contain many items. This API command will return all photos 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}&{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 photo library. This key can be found by calling the Libraries API command and looking for a photo library. |
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 information for the folder of all the photos in a library. An example of the XML returned from the request is shown below:
<?xml version="1.0" encoding="UTF-8"?> <MediaContainer size="25" allowSync="1" art="/:/resources/photo-fanart.jpg" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="Photos" librarySectionUUID="fc948ea9-3fad-45e2-99ef-b461b2d746d2" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1641342384" nocache="1" sortAsc="1" thumb="/:/resources/photo.png" title1="Photos" title2="All Photos" viewGroup="photo" viewMode="458810"> <Directory ratingKey="3663" key="/library/metadata/3663/children" guid="local://3663" type="photo" title="2002" summary="" index="1" composite="/library/metadata/3663/composite/1611751196" thumb="/library/metadata/3663/thumb/1611751196" art="/library/metadata/3663/art/1611751196" addedAt="1430260593" updatedAt="1611751196"></Directory> ... </MediaContainer>
The XML returned provides a list of the all photos 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 photos on the server.
Attribute | Description |
---|---|
size | The number of libraries. |
allowSync | 1 - allow syncing content. 0 - don't allow syncing content. |
art | Background artwork used to represent the library. |
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. |
sortAsc | 1 - the library is sorted in ascending order. 0 - the library is sorted in descending order. |
thumb | The thumbnail for the library. |
title1 | The title of the library. Note: This appears to be internally created, and can't be changed by the server owner. |
title2 | A descriptive title for the library. |
viewGroup | The group type used to view the library. |
viewMode | Unknown integer value. |
The size
attribute represents the number of photo folders that are available in the library.
Within the MediaContainer
there are one or more Directory
child elements. Each Directory
element represents one photo folder that has been associated with the Plex server.
Attribute | Description |
---|---|
ratingKey | A key associated with the photo folder. |
key | The relative URL of the information for the photo folder. |
guid | The unique identifier for the photo folder. |
type | The type of item represented by this Directory element. |
title | The name of the photo folder. |
summary | Information about the photo folder. |
index | Unknown. |
composite | The composite image associated with the photo folder. |
thumb | The thumbnail for the photo folder. |
art | The background artwork used to represent the photo folder. |
addedAt | The date and time the photo folder was added to the library. |
updatedAt | The date and time the photo folder was updated in the library. |
Remarks
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