-
Notifications
You must be signed in to change notification settings - Fork 18
REST API
Elijah Lopez edited this page Apr 24, 2021
·
36 revisions
This is some of the REST API that you can call to control music caster. The default API endpoint is http://localhost:2001/. In cases where the port 2001 is already being used, Music Caster will keep trying to bind to the next highest port (e.g. 2002, 2003, etc.).
GET /running/
- this method is useful for verifying Music Caster is running on the port you assumed it was running on
-
tipcheck if Music Caster is alive processbefore iterating port numbers [2001, 2010] and and trying to call the API -
returnstrue
POST ?activate
- activates the main window
POST ?play
- the
is_apiflag is used to return API messages. If you don't supply it, you will get redirected to/instead of receiving a API response - if paused, resume playback.
- else if tracks are in the queue, play the first item (index 0).
- else if there are no tracks in the queue, library is shuffled and played (if any tracks were queued).
POST ?pause
- pauses the player
POST ?next×=1
- try to skip track $times times
- add
&ignore_timestampsto ignore chapter traversing behaviour - return value does not indicate success
PSOT ?prev×=1
- try to go to the previous track $times times
- add
&ignore_timestampsto ignore chapter traversing behaviour - return value does not indicate success
POST ?repeat
- cycles repeat
- repeat states include:
off,one(repeat current track), andall(plays queue on repeat)
POST ?shuffle
- toggles shuffle for playlists
GET /state/
- returns the state of Music Caster. Used to auto-refresh the Web GUI.
{'artist': '', 'title': '', 'track_number': '', 'album': '', 'lang': '', 'volume': 10, 'queue_length': 0}
POST /play/
- play or queue files/folders/urls/playlists
json = {'uris': ['file_path', 'folder_path', 'url', 'playlist_name']}json = {'uri': 'file_path/folder_path/url/playlist_name', 'queue': true}-
DEFAULTS:queue: false
POST /exit/
- stop playing and exit
GET /refresh-devices/
- scan for Chromecasts on the network
GET/POST /timer/
-
GETthe current timer -
POSTpossible_args = 'cancel', minutes, 'HH:MM'