XML 4.3
Lets go through come calls and examples that you can do for each XML method.
Remember that Binary data methods will not return xml; just the file/data you have requested.
Non-Data Methods
handshake
This is the function that handles verifying a new handshake Takes a timestamp, auth key, and username.
Input | Type | Description | Optional |
---|---|---|---|
'auth' | string | $passphrase (Timestamp . Password SHA hash) OR (API Key) | NO |
'user' | string | $username (Required if login/password authentication) | YES |
'timestamp' | integer | UNIXTIME() (Timestamp used in seed of password hash. Required if login/password authentication) | YES |
'version' | string | $version (API Version that the application understands) | YES |
ping
This can be called without being authenticated, it is useful for determining if what the status of the server is, and what version it is running/compatible with
Input | Type | Description | Optional |
---|---|---|---|
'auth' | string | (Session ID) returns version information and extends the session if passed | YES |
'version' | string | $version (API Version that the application understands) | YES |
goodbye
Destroy a session using the auth parameter.
Input | Type | Description | Optional |
---|---|---|---|
'auth' | string | (Session ID) destroys the session if it exists | NO |
url_to_song
This takes a url and returns the song object in question
Input | Type | Description | Optional |
---|---|---|---|
'url' | string | Full Ampache URL from server, translates back into a song XML | NO |
Data Methods
get_indexes
This takes a collection of inputs and returns ID + name for the object type
Input | Type | Description | Optional |
---|---|---|---|
'type' | string | song , album , artist , playlist | NO |
'filter' | string | YES | |
'add' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date | YES |
'update' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date | YES |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum results for the chosen type | YES |
'hide_search' | integer | 0 , 1 (if true do not include searches/smartlists in the result) | YES |
SONGS
ARTIST
ALBUM
PLAYLIST
advanced_search
Changes to text searches
- 'is not' has been added shifting values down the list. 0=contains, 1=does not contain, 2=starts with, 3=ends with 4=is, 5=is not, 6=sounds like, 7=does not sound like
- rule_1['name'] is depreciated. Instead of rule_1['name'] use rule_1['title'] (I have put a temp workaround into the search rules to alleviate this change for any existing apps)
Using advanced_search
Perform an advanced search given passed rules. This works in a similar way to the web/UI search pages. You can pass multiple rules as well as joins to create in depth search results
Rules must be sent in groups of 3 using an int (starting from 1) to designate which rules are combined. Use operator ('and'|'or') to choose whether to join or separate each rule when searching.
Refer to the Advanced Search page for details about creating searches.
INPUTS
- ampache_url = (string)
- ampache_API = (string)
- operator = (string) 'and'|'or' (whether to match one rule or all)
- rules = (array) = [[
rule_1
,rule_1_operator
,rule_1_input
], [rule_2
,rule_2_operator
,rule_2_input
], [etc]] - type = (string)
song
,album
,artist
,playlist
,label
,user
,video
- random = (integer)
0
,1
(random order of results; default to 0) - offset = (integer)
- limit' = (integer)
SONG
ARTIST
ALBUM
artists
This takes a collection of inputs and returns artist objects.
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | Value is Alpha Match for returned results, may be more than one letter/number | YES |
'exact' | boolean | if true filter is exact rather then fuzzy | YES |
'add' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date | YES |
'update' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date | YES |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
'include' | string | albums , songs (include child objects in the response) | YES |
artist
This returns a single artist based on the UID of said artist
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | UID of Artist, returns artist XML | NO |
'include' | array | Array specified using GET convention, can contain albums or songs and will include the corresponding XML nested in the artist XML | NO |
artist_albums
This returns the albums of an artist
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of Artist, returns Album XML | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
artist_songs
This returns the songs of the specified artist
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of Artist, returns Song XML | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
albums
This returns albums based on the provided search filters
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | Value is Alpha Match for returned results, may be more than one letter/number | YES |
'exact' | boolean | if true filter is exact rather then fuzzy | NO |
'add' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date | YES |
'update' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date | YES |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | YES | |
'include' | string | albums , songs (include child objects in the response) | YES |
album
This returns a single album based on the UID provided
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of Album, returns album XML | NO |
'include' | array | Array specified using GET convention, can contain songs and will include the corresponding XML nested in the album XML | NO |
album_songs
This returns the songs of a specified album
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of Album, returns song XML | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
tags
This returns the tags (Genres) based on the specified filter
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | Value is Alpha Match for returned results, may be more than one letter/number | YES |
'exact' | boolean | if true filter is exact rather then fuzzy | YES |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
tag
This returns a single tag based on UID
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of tag, returns tag XML | NO |
tag_artists
This returns the artists associated with the tag in question as defined by the UID
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of tag, returns artist XML | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
tag_albums
This returns the albums associated with the tag in question
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of tag, returns album XML | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
tag_songs
returns the songs for this tag
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of tag, returns song XML | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
songs
Returns songs based on the specified filter
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | Value is Alpha Match for returned results, may be more than one letter/number | NO |
'add' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date | YES |
'update' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date | YES |
'exact' | boolean | if true filter is exact rather then fuzzy | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
song
returns a single song
Input | Type | Description | Optional |
---|---|---|---|
'filter' | integer | UID of Song, returns song XML | NO |
playlists
This returns playlists based on the specified filter
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | Value is Alpha Match for returned results, may be more than one letter/number | YES |
'exact' | boolean | if true filter is exact rather then fuzzy | YES |
'add' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'add' date newer than the specified date | YES |
'update' | set_filter | ISO 8601 Date Format (2020-09-16) Find objects with an 'update' time newer than the specified date | YES |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
'hide_search' | integer | 0 , 1 (if true do not include searches/smartlists in the result) | YES |
playlist
This returns a single playlist
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | UID of playlist, returns playlist XML | NO |
playlist_songs
This returns the songs for a playlist
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | UID of Playlist, returns song XML | NO |
'offset' | integer | Return results starting from this index position | YES |
'limit' | integer | Maximum number of results to return | YES |
playlist_create
This create a new playlist and return it
Input | Type | Description | Optional |
---|---|---|---|
'name' | string | Playlist name | NO |
'type' | string | public , private (Playlist type) | YES |
playlist_edit
This modifies name and type of a playlist Previously name and type were mandatory while filter wasn't. this has been reversed.
Input | Type | Description | Optional |
---|---|---|---|
'filter' | string | UID of Playlist | NO |
'name' | string | Playlist name | YES |
'type' | string | public , private (Playlist type) | YES |
'items' | string | comma-separated song_id's (replace existing items with a new object_id) | YES |
'tracks' | string | comma-separated playlisttrack numbers matched to items in order | YES |