Rest API Reference

The Request API is used to request a new transaction from the server.

Note

Player is debend on rest api. beacuse new lavalink version is only support rest api.

class lavaplay.rest.RestApi(*, host: str = '127.0.0.1', port: int, password: str, ssl: bool = False, version: Literal['v3', 'v4'] = 'v4')[source]

The class make a request to the rest api for lavalink.

Parameters

host: str

ip address for lavalink server, default ip address for lavalink is ``

port: int

The port to use for websocket and REST connections.

password: str

The password used for authentication.

is_ssl: bool

Is server using ssl.

version: str

The version for lavalink server, default version is v4, newer version and recommend.

async request(method: str, rout: str, data: dict = {}, without_version: bool = False) dict[source]

This function makes a request to the rest api for lavalink

Parameters

method: str

method for request like GET or POST etc.

rout: str

The route for request.

data: dict

The data for request.

Returns

dict

The response from the request.

async load_tracks(identifier: str) dict[source]

This function makes a request to the rest api for lavalink

Parameters

identifier: str

The identifier for search tracks.

Returns

dict

The response from the request.

async decode_track(track: str) dict[source]

This function makes a request to the rest api for lavalink

Parameters

track: str

The track for decode.

Returns

dict

The response from the request.

async decode_tracks(tracks: list) dict[source]

This function makes a request to the rest api for lavalink

Parameters

tracks: list

The tracks for decode.

Returns

dict

The response from the request.

async info() dict[source]

This function makes a request to the rest api for lavalink

Returns

dict

The response from the request.

async stats() dict[source]

This function makes a request to the rest api for lavalink

Returns

dict

The response from the request.

async router_planner() dict[source]

This function makes a request to the rest api for lavalink

Returns

dict

The response from the request.

async unmark_failed_address(address: str) dict[source]

This function makes a request to the rest api for lavalink

Parameters

address: str

The address for unmark.

Returns

dict

The response from the request.

async unmark_all_failed_address() dict[source]

This function makes a request to the rest api for lavalink

Returns

dict

The response from the request.

async get_players(session_id: str) dict[source]

This function makes a request to the rest api for lavalink

Parameters

session_id: str

The session id for get players.

Returns

dict

The response from the request.

async get_player(session_id: str, guild_id: str) dict[source]

This function makes a request to the rest api for lavalink

Parameters

session_id: str

The session id for get player.

guild_id: str

The guild id for get player.

Returns

dict

The response from the request.

async update_player(session_id: str, guild_id: int, noReplace: bool = False, data: dict = {}) dict[source]

This function makes a request to the rest api for lavalink

Parameters

session_id: str

The session id for update player.

guild_id: int

The guild id for update player.

noReplace: bool

The noReplace for update player.

Returns

dict

The response from the request.

async destroy_player(session_id: str, guild_id: int) None[source]

This function makes a request to the rest api for lavalink

Parameters

session_id: str

The session id for destroy player.

guild_id: str

The guild id for destroy player.

async update_session(session_id: str, data: dict) dict[source]

This function makes a request to the rest api for lavalink

Parameters

session_id: str

The session id for update session.

data: dict

The data for update session.

Returns

dict

The response from the request.

async version() dict[source]

This function makes a request to the rest api for lavalink

Returns

dict

The response from the request.