Skip to content
Splamy edited this page Feb 1, 2017 · 19 revisions

TS3AudioBot Web API

Calling API functions

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)

API call syntax

The API address is

http://<address:port>/api/<command>/<param1>/<param2>

where <address:port> is your server address and the configured port (default 8180)

Simple API call

http://localhost:8180/api/history/last/10

This will get a JSON array with the last 10 played songs.

Escaping

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.

Command chaining

The command chaining works exactly like from the TeamSpeak chat, except ' ' is replaced with '/' and '(!' is replaced with (/

An example:

!history play (!rng 0 100)
// will become
http://localhost:8180/api/history/play/(/rng/0/100)

Available API functions

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

Authentication

(In progress)

Tips 'n Tricks

Json Merge

If you want to request multiple information in on request you can use the !json merge command

/// TODO EXAMPLE ///

AST Parser

To see how a command is parsed you can use !parse to get an abstract syntax tree (=AST)

/// TODO EXAMPLE ///

Clone this wiki locally