VRisingServerApiPlugin Mod for V Rising
Details :
Extend Your V Rising Server’s Functionality with VRisingServerApiPlugin
Unlock the potential of your V Rising server with VRisingServerApiPlugin! This HTTP API plugin framework enables you to seamlessly add new routes to your existing V Rising Server’s HTTP API, expanding its capabilities and enhancing server functionality. Here’s how to configure and utilize this powerful plugin:
Configuring the Server:
In the ServerHostSettings.json file of your V Rising server, activate the API by setting “Enabled” to true:
{
"API": {
"Enabled": true,
"BindAddress": "*",
"BindPort": 9090,
"BasePath": "/",
"AccessList": "",
"PrometheusDelay": 30
}
}
Place the DLL of the VRisingServerApiPlugin in the plugins directory of the BepInEx folder on your server. You’ll see the new routes created in the logs. You can then call these routes using another program or tools like Postman to query the available endpoints.
How It Works:
VRisingServerApiPlugin exposes endpoints through the VRising Server HTTP API. Examples of these endpoints, along with their implementation details, can be found in the endpoints folder of the project. The plugin supports basic GET and POST methods for endpoints such as clans and players.
The API can parse URL parameters, query parameters, and JSON bodies. Only JSON bodies are supported, and the Content-Type must be set to application/json in the HTTP request header.
URL parameters are matched using regex groups. For example, to match the userIndex in the endpoint /players/:id, the endpoint is declared as follows:
[HttpGet("/(?<id>[0-9]*)")]
public PlayerApiResponse GetPlayerDetails([UrlParam("id")] int userIndex)
The plugin will attempt to cast URL parameters, query parameters, and request bodies to the parameter type of the method.
Using the Plugin as a Dependency:
The CommandRegistry exposes a public method RegisterAll
. Import the DLL of the project as a dependency to your own plugin, declare API endpoints using the attribute declarations explained above, and then call CommandRegistry.RegisterAll()
to register your assembly.