Skip to main content

API Browse methods

API Browse methods

A browse method returns many items that can be filtered and sorted further, so artists is a browse and artist is not. Browse methods use the Ampache Browse class, which lets a client ask for a narrower or differently ordered list without running a search or post-processing the response.

Every browse method takes two extra parameters on top of its own: cond and sort.

cond

Filter the objects the browse returns.

Send comma separated filter and value pairs, and split additional filters with ;

e.g. &cond=artist,1240;catalog,2

A filter a browse does not list is ignored, so check the page for the type you are browsing.

Example:

  • The songs method uses a song browse to return song objects.
  • Filtering it by genre returns every song with that genre.

e.g. https://music.com.au/server/json.server.php?action=songs&auth=eeb9f1b6056246a7d563f479f518bb34&cond=genre,111

A method that already sets a filter of its own is overwritten by the same filter in cond, which can change the response in ways the method never intended. genre_artists?filter=215&cond=tag,111 returns the artists for genre 111, not 215.

These filters carry no value, so filter, with an empty value is enough: catalog_enabled, hide_dupe_smartlist, no_genre, no_tag, smartlist, user_catalog

Every other filter needs one. unplayed in particular only works as cond=unplayed,1; an empty value is read as 0 and the filter is dropped.

sort

Change the order of the response.

Send the sort name and the direction, ASC or DESC.

e.g. https://music.com.au/server/json.server.php?action=users&auth=f57766d256df0ad5e5ec163d35f05a21&sort=username,DESC

NOTE Only one sort is applied to a browse. Sending a second replaces the first.

The default sort is usually name, ascending. Each method's sort docstring names its own default.

A sort the browse does not list is ignored and the default is kept, so nothing tells the client that the order it asked for was refused.

Browse types and available methods

Each page lists every filter and sort that browse accepts, and what each one does.

BrowseTypeAPI methods
Album Browsealbumalbums, artist_albums, browse, genre_albums
Album Disk Browsealbum_diskalbum_disks
Artist Browseartistartists, browse, genre_artists, label_artists
Catalog Browsecatalogbrowse, catalogs
Folder Browsefolderfolders
Follower Browsefollowerfollowers
Genre Browsetaggenres
Label Browselabellabels
License Browselicenselicenses
Live Stream Browselive_streamlive_streams
Playlist Browseplaylistplaylists, user_playlists
Playlist Search Browseplaylist_searchindex, list, playlist_folder_items, playlists, stats
Podcast Browsepodcastbrowse, podcasts
Podcast Episode Browsepodcast_episodebrowse, podcast_episodes
Share Browseshareshares
Smartlist Browsesmartplaylistsmartlists, user_smartlists
Song Browsesongalbum_disk_songs, album_songs, artist_songs, browse, genre_songs, license_songs, songs
User Browseuserusers
Video Browsevideobrowse, videos

NOTE A browse usually maps to one database table. playlist_search is the exception: it reads playlist and search together so playlists and smartlists arrive as one list, with smartlist ids prefixed, so search 2256 is returned as smart_2256.

NOTE album_artist and song_artist are the artist browse with that filter already applied, so they take the artist filters and sorts.

NOTE (API8) catalog is an optional filter on the album_artist, artist, album, album_disk and podcast browse types instead of a required parameter. Send it to restrict the children to one catalog, or leave it out to get them from every catalog you can see. An album, disk or podcast belongs to a single catalog and an artist reaches its catalogs through catalog_map, so the parent object never needed a catalog to be addressed. API6 keeps the parameter mandatory, because Ampache7 serves that version too.

Which browse takes which filter

A filter sent to a browse that does not list it is ignored, and logged as an unknown filter.

FilterBrowse types
accessuser
add_gtalbum, album_disk, artist, podcast_episode, song, video
add_ltalbum, album_disk, artist, podcast_episode, song, video
albumalbum_disk, song
album_artistalbum, album_disk, artist
album_disksong
alpha_matchalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
artistalbum, album_disk, song
catalogalbum, album_disk, artist, live_stream, podcast, podcast_episode, song, video
catalog_enabledalbum, album_disk, artist, live_stream, podcast, podcast_episode, song, video
disableduser
disksong
enabledcatalog, song
equalalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
exact_matchalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
follow_userfollower
gather_typecatalog
gather_typescatalog
genrealbum, album_disk, artist, genre, song, video
hiddengenre, license
hide_dupe_smartlistplaylist_search
idalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
int_idfolder
labelartist
licensesong
likealbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
no_genrealbum, album_disk, artist, song, video
no_tagalbum, album_disk, artist, song, video
not_likealbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
not_starts_withalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
object_typegenre
playlist_openplaylist, playlist_search, smartplaylist
playlist_typeplaylist, playlist_search, smartplaylist
playlist_userplaylist, playlist_search, smartplaylist
podcastpodcast_episode
regex_matchalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
regex_not_matchalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
smartlistplaylist_search
song_artistalbum, album_disk, artist
starts_withalbum, album_disk, artist, catalog, folder, genre, label, license, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, user, video
tagalbum, album_disk, artist, genre, song, video
top50song
unplayedalbum, album_disk, artist, podcast, podcast_episode, song
update_gtalbum, album_disk, artist, song, video
update_ltalbum, album_disk, artist, song, video
usercatalog, follower
user_catalogalbum, album_disk, artist, live_stream, podcast, podcast_episode, song, video
user_flagalbum, album_disk, artist, folder, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, video
user_ratingalbum, album_disk, artist, folder, live_stream, playlist, playlist_search, podcast, podcast_episode, smartplaylist, song, video