-
Notifications
You must be signed in to change notification settings - Fork 2
API Document
leejaedus edited this page Nov 27, 2016
·
4 revisions
Endpoint: ws://host:port/api/v1/ws
Basic Data Structure:
{"category": "", "command": "", "value": {}}
API
-
PlayList
- Fetch playlist
{ "category":"playlist", "command":"fetch" }
- Add song to playlist
{ "category":"playlist", "command":"add", "value":{ "title":"title of the song", "sid":"id of youtube video" } }
- Delete song in playlist
{ "category":"playlist", "command":"delete", "value":{ "spk":"primary key of song from api response", } }
-
Control
- Start or Stop playlist
{ "category":"control", "command":"`start` or `stop`" }
- Change the current song which is playing
{ "category":"control", "command":"change", "value":{ "spk":"primary key of song from api response", } }
Response
All of reponse has same data structure.
{
"success":true,
"items":[
{
"pk":"primary key of song",
"title":"title of song",
"song_id":"id of youtube video",
"is_playing":"play status of song",
"current_time": 0,
"duration": 10,
"index": 1,
"uuid": "c5a4da38-5684-42a5-8038-b8bdc12cec99"
}
],
"activeItem": {
"pk":"primary key of song",
"title":"title of song",
"song_id":"id of youtube video",
"is_playing":"play status of song",
"current_time": 0,
"duration": 10,
"index": 1,
"uuid": "c5a4da38-5684-42a5-8038-b8bdc12cec99"
}
}