Get All Music Albums for an Artist
A music artist can have one or more albums associated with them This API command will return all of the albums from the Plex server that are associated with an artist.
URL
GET http://{ip_address}:32400/library/sections/{library_id/all?artist.id={artist_id}&type=9&X-Plex-Token={plex_token}&includeGuids={include_guids}
Parameters
Name | Description |
---|---|
ip_address | The IP address of the Plex Media server. |
plex_token | The Plex token. |
library_id | The key associated with a music library. This key can be found by calling the Libraries API command and looking for a music library. |
artist_id | The key associated with the music artist. This key can be found by calling the Get All Music Artists API command and using the ratingKey attribute associated with the artist. |
include_guids | (Optional) Returns the GUID values of the online metadata services associated to the media item. |
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 all the albums for the music artists in the library. An example of the XML returned from the request is shown below:
<?xml version="1.0" encoding="UTF-8"?> <MediaContainer size="1" allowSync="1" art="/:/resources/artist-fanart.jpg" identifier="com.plexapp.plugins.library" librarySectionID="8" librarySectionTitle="Music" librarySectionUUID="b6031749-2969-4027-afee-64172b72b77d" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1682076900" nocache="1" thumb="/:/resources/artist.png" title1="Music" title2="All Artists" viewGroup="artist" viewMode="65592"> <Directory ratingKey="218549" key="/library/metadata/218549/children" parentRatingKey="218548" guid="plex://album/5d07c182403c64029084e584" parentGuid="plex://artist/5d07bbfd403c6402904a6593" studio="Polydor" type="album" title="Gold: Greatest Hits" parentKey="/library/metadata/218548" parentTitle="ABBA" summary="ABBA's 19-song Gold collection was the first hits compilation prepared specifically for the CD format by the 1970s supergroup, and, appearing after a period of several years in which their music had been off the market, was a welcome addition to the catalog. It is still the simplest and most straightforward collection of the group's material that it is possible to buy. ~ Bruce Eder" index="1" rating="10.0" lastViewedAt="1646942889" year="1992" thumb="/library/metadata/218549/thumb/1685475601" art="/library/metadata/218548/art/1685475583" parentThumb="/library/metadata/218548/thumb/1685475583" originallyAvailableAt="1992-09-21" addedAt="1598373482" updatedAt="1685475601" loudnessAnalysisVersion="2" musicAnalysisVersion="1"> <Genre tag="Pop/Rock" /> </Directory> ... </MediaContainer>
The XML returned provides a list of the all the albums associated with a music artist 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 albums on the server.
Attribute | Description |
---|---|
size | The number of albums. |
allowSync | 1 - allow syncing content. 0 - don't allow syncing content. |
art | Background artwork used to represent the album. |
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 album. |
title1 | The title of the album. Note: This appears to be internally created, and can't be changed by the server owner. |
title2 | A descriptive title for the album. |
viewGroup | The group type used to view the album. |
viewMode | Unknown integer value. |
Within the MediaContainer
there are one or more Directory
child elements. Each Directory
element represents one album available on the Plex server.
Attribute | Description |
---|---|
ratingKey | A key associated with the album. |
key | The relative URL of the information for the album. |
parentRatingKey | A key associated with the artist. |
guid | The unique identifier for the album. |
parentGuid | The unique identifier associated with the artist. |
studio | The name of the studio that created the album. |
type | The type of item represented by this Directory element. |
title | The name of the album. |
parentKey | The key associated with the artist. |
parentTitle | The title associated with the artist. |
summary | Information about the album. |
index | Unknown. |
rating | The rating for the album. |
lastViewedAt | The date and time the album was last viewed. |
year | The year the album was released. |
thumb | The thumbnail for the album. |
art | The background artwork used to represent the album. |
parentThumb | The studio associated with the artist. |
originallyAvailableAt | The original release date of the album. |
addedAt | The date and time the album was added to the library. |
updatedAt | The date and time the album was updated in the library. |
loudnessAnalysisVersion | The version of the loudness analyzer used. |
musicAnalysisVersion | The version of the music analyzer used. |
Also within the Directory
element there are one or more Genre
child elements that describes the genre of the albums. .
Within each of these child elements is a single tag
attribute that provides the information for the element.
Attribute | Description |
---|---|
tag | A genre of the album. |
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.
Examples
curl -X GET http://{ip_address}:32400/library/sections/{library_id/all?artist.id={artist_id}&type=9&X-Plex-Token={plex_token}
import requests plex_url = http://{ip_address}:32400/library/sections/{library_id/all?artist.id={artist_id}&type=9&X-Plex-Token={plex_token} response = requests.get(plex_url) print(response.text)
$response = Invoke-RestMethod 'http://{ip_address}:32400/library/sections/{library_id/all?artist.id={artist_id}&type=9&X-Plex-Token={plex_token}' -Method 'GET' Write-Output $response