-
Notifications
You must be signed in to change notification settings - Fork 10
Service API
Snakeberry is a RESTful webservice. So you can control it by callong following webservice endpoint URLs.
All methods return a JSON Response object. Containing an ErrorCode (0 if no error occured), an ErrorMessage (empty if no error occured) and a ResponseData-Object. This ResponseData-Object is different for every method of the service an described below.
Method GET
URL: :8888/
Returns a list of all available services in the ResponseData-Object.
{"ErrorCode": 0, "ResponseData": {"Services": [{"DisplayName": "Radio", "BaseUrl": "/radio"}]}, "ErrorMessage": ""}
Method GET
URL: :8888/
Returns a list of all available radio stations.
{"ErrorCode": 0, "ResponseData": {"Radios": [{"StreamUrl": "mms://apasf.apa.at/OE3_Live_Audio", "DisplayName": "OE3", "RadioId": "OE3"}, {"StreamUrl": "http://mp3stream1.apasf.apa.at:8000", "DisplayName": "FM4", "RadioId": "FM4"}, {"StreamUrl": "http://bbc.co.uk/radio/listen/live/r1_aaclca.pls", "DisplayName": "BBC1", "RadioId": "BBC1"}, {"StreamUrl": "http://www.antennestream.at", "DisplayName": "Antenne Kaernten", "RadioId": "ATNKTN"}]}, "ErrorMessage": ""}
Method GET
URL: :8888/getmac
Returns the hardware adress of the raspberry as decimal not as HEX.
{"ErrorCode": 0, "ResponseData": 100068776059597, "ErrorMessage": ""}
Method GET
URL: :8888/radio/play/
Starts to play a radio station on Raspberry.
{"ErrorCode": 0, "ResponseData": null, "ErrorMessage": ""}
Method GET
URL: :8888/radio/stop
Stops radio station on Raspberry.
{"ErrorCode": 0, "ResponseData": null, "ErrorMessage": ""}
Method GET
URL: :8888/radio/nowplaying
Stops radio station on Raspberry.
{"ErrorCode": 0, "ResponseData": {"MediaURI": "mms://apasf.apa.at/OE3_Live_Audio", "PID": 2069, "MediaType": "Radio", "Description": "OE3"}, "ErrorMessage": ""}
Method GET
URL: :8888/getvolume
Gets the system volume. This is a value between -10239 (0%) and 400 (100%).
{"ErrorCode": 0, "ResponseData": -400, "ErrorMessage": ""}
Method GET
URL: :8888/setvolume/
Sets the system volume. This is a value between -10239 (0%) and 400 (100%).
{"ErrorCode": 0, "ResponseData": null, "ErrorMessage": ""}