rest - What is a restful way to implement this proposed API? -


so i'm trying develop music player office restful api. in nutshell, api able download music youtube , load current playlist of running mpd instance. want able control playback / volume api

here's kind of thinking far:

endpoint: /queue     methods:         get: gets current mpd playlist         post: accepts json these arguments:            source-type: specify type of source of music (usually youtube, might want expand later support pulling soundcloud, etc)            source-desc: used in conjunction source-type, ie, if source-type youtube, youtube search query            use these arguments go out , find song want , put in queue         delete: clear queue  endpoint: /playbackcontrol     methods:         get: returns volume, whether playing, paused, or stopped, etc         post: accepts json these arguments:             operation: describe operation want (ie, next, previous, volume adjust)             optional_value: value operations need value (like volume) 

so that's i'm thinking right now. know high level, wanted input see if i'm on right track. acceptable way implement such api?

delete clear queue not cool. put empty queue representation instead. come in handy later when want able rearrange items in queue, remove them 1 one etc.—you can current queue, apply changes , put back.

volume better modeled separate /status/volume resource , put. maybe patch if absolutely need distinct “volume up” , “volume down” operations (that is, if client not keeping track of current volume).

ditto playing/paused/stopped status: get/put /status/playback.

to seed client current status, make get /status respond summary of what’s going on: current track, volume, playing/paused.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -