-
-
Notifications
You must be signed in to change notification settings - Fork 150
WebAPI
First make sure the WebData::EnableApi setting is set to true so that the websever runs.
To access the API via your domain, make sure it is listed in the WebData::HostAddress setting. (This is a space seperated list)
The API address is
http://<address:port>/api/<command>/<param1>/<param2>
where <address:port> is your server address and the configured port (default 8180)
http://localhost:8180/api/history/last/10
This will get a JSON array with the last 10 played songs.
All parameter need to be URL Encoded (see here or here)
For example if you want a parameter with a space or slash it would look like that:
http://localhost:8180/api/history/title/Text%20with%20Spaces%2FSlashes
This will search for all songs containing Text with Spaces/Slashes in the title.
Quoted strings are not used in API calls since the syntax is not ambiguous anymore with URL Encoding.
E.g. use ) when you want to close a subcommand, use %29 when you want the closing bracket character.
The command chaining works exactly like from the TeamSpeak chat, except (space) is replaced with / (forward slash) and (! is replaced with (/
An example:
!history play (!rng 0 100)
// will become
http://localhost:8180/api/history/play/(/rng/0/100)
The (almost) entire command list from the bot is also available from the web api.
For more information about a particular command please refer to the Full Command List
(In progress)
If you want to request multiple information in on request you can use the !json merge command. Example:
http://localhost:8180/api/json/merge/(/loop)/(/repeat)/(/quiz)/(/random)/(/random/seed)
// Result:
[ { "Value": false },
{ "Value": false },
{ "Value": false },
{ "Value": true },
{ "Value": "aezalnb" } ]
will return an array of all subcommands which return an json object.
To see how a command is parsed you can use !parse to get an abstract syntax tree (=AST)
/// TODO EXAMPLE ///