-
Notifications
You must be signed in to change notification settings - Fork 0
API reference
API objects are bits of json encoded data used by the API. Each API object represents a certain "thing" in the backend, for example a track, artist or album. There is an id associated with every API object, which is used to identify the object uniquely between API, backend and frontend. Each API object has at least the following information:
{ 'id': 123456, 'type': 'some_type', 'follow': '/path/to/object/123456', 'data': { ... } }
Where id
is the object unique id and type
is the object's type.
follow
contains the URL of the API call which returns this object.
data
contains any type specific data as listed below.
Gotcha: id may be reused for different types. Make sure to use the right endpoint for accessing the object by it's id.
Gotcha: some nested API objects may not contain data
to keep network traffic low. Use the follow
URL to obtain the complete object.
Below is a list of all API object types and contained data fields:
The artist API object the track is from.
The album API object the track is on.
A string containing the track title.
A string containing the album title.
The artist API object the album is from.
A string containing the artists name.
Whenever an action is performed that might not succeed (registering a user, uploading a track, etc.) an error might be returned by the API. An error is indicated by a json response containing a "success" and a "reason" field. In the case of an error, "success" is set to "false". The "reason" field contains an integer error code. Below is a list of all error codes:
The request was malformed and couldn't be completed.
No object exists with the requested id.
The user who is logged in with the given session token isn't authorized to perform the requested action.
During login: The given user credentials are not valid.
During registration: The username already exists.
During /queue/add: The requested Track is not available for playback.
During /queue/remove: The requested Track isn't enqueued.
During upload: The uploaded track already exists.
During upload: The upload plugin encountered an error and the upload couldn't be completed.
During upload: The given upload plugin doesn't exist on the server.
Returns all imported and available tracks.
http parameters:
int: start - - Specifies the id of the first track to be returned. If used, no track with an id lower than start will be returned.
int: amount - - Specifies the amount of tracks to be returned. If left empty, no limit is applied.
Returns all tracks that're not fully imported yet.
http parameters:
int: start - - Specifies the id of the first track to be returned. If used, no track with an id lower than start will be returned.
int: amount - - Specifies the amount of tracks to be returned. If left empty, no limit is applied.
Returns all imported but unavailable tracks.
http parameters:
int: start - - Specifies the id of the first track to be returned. If used, no track with an id lower than start will be returned.
int: amount - - Specifies the amount of tracks to be returned. If left empty, no limit is applied.
Returns all tracks on the album specified by album_id.
Returns all tracks by the artist specified by artist_id.
Returns the track specified by track_id.
Returns all albums that have at least one imported and available track.
http parameters:
int: start - - Specifies the id of the first album to be returned. If used, no album with an id lower than start will be returned.
int: amount - - Specifies the amount of albums to be returned. If left empty, no limit is applied.
Returns all albums by the artist specified by artist_id.
Returns the album specified by album_id.
Returns all artists that have at least one imported and available track.
http parameters:
int: start - - Specifies the id of the first artist to be returned. If used, no artist with an id lower than start will be returned.
int: amount - - Specifies the amount of artists to be returned. If left empty, no limit is applied.
Returns the artist specified by artist_id.
Returns all tracks that are currently en-queued, excluding the currently playing track.
Returns the track that is currently playing.
http parameters:
int: track_id - - The id of the track to add to the queue
Adds a track to the queue.
http parameters:
int: track_id - - The id of the track to remove from the queue
Removes a track from the queue.
http parameters:
int: username - - The new user's username.
int: password - - The new user's password.
int: privilege - - optional The new user's privilege level (0 by default).
Creates a new user with the given credentials.
http parameters:
int: username - - The user's username.
int: password - - The user's password.
Logs the user with the given credentials in. Returns a user token on success, which can be passed as the http parameter "token" in every subsequent API request to indicate that the request was performed by the user associated with the token. The token auto-invalidates, the ttl can be set in the config under "user_ttl".
Adding a source