AternosAPI 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package AternosAPI --version 1.0.4                
NuGet\Install-Package AternosAPI -Version 1.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AternosAPI" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AternosAPI --version 1.0.4                
#r "nuget: AternosAPI, 1.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AternosAPI as a Cake Addin
#addin nuget:?package=AternosAPI&version=1.0.4

// Install AternosAPI as a Cake Tool
#tool nuget:?package=AternosAPI&version=1.0.4                

AternosAPI

NuGet version

Unofficial aternos.org client to control your server(s).

Example usage:

var aternosClient = new AternosClient("<YOUR ATERNOS TOKEN>");
var success = await aternosClient.PrepareAsync();
if (!success) {
  Console.WriteLine("Failed to fetch ajax token!");
  return;
}

// Auto select server
success = await aternosClient.UpdateServerIdAsync();
if (!success) {
  Console.WriteLine("Failed to update sever id!");
  return;
}

// Start selected server
success = await aternosClient.StartSelectedServerAsync();
if (!success) {
  Console.WriteLine("Failed to start the selected server!");
  return;
}

// Stop selected server
success = await aternosClient.StopSelectedServerAsync();
if (!success) {
  Console.WriteLine("Failed to stop the selected server!");
  return;
}

// Restart selected server
success = await aternosClient.RestartSelectedServerAsync();
if (!success) {
  Console.WriteLine("Failed to restart the selected server!");
  return;
}

// Change a setting (max player count in this example)
success = await aternosClient.ChangeSelectedServerConfigAsync("/server.properties", "max-players", "50");
if (!success) {
  Console.WriteLine("Failed to change config!");
  return;
}

// Add a player to a list
success = await aternosClient.AddPlayerToListAsync(AternosList.Whitelist, "test");
if (!success) {
  Console.WriteLine("Failed to add player to whitelist!");
  return;
}

// Remove a player from a list
success = await aternosClient.RemovePlayerFromListAsync(AternosList.Whitelist, "test");
if (!success) {
  Console.WriteLine("Failed to remove player from whitelist!");
  return;
}

// Install software
success = await aternosClient.InstallSoftwareAsync("<SOFTWARE ID>", false);
if (!success) {
  Console.WriteLine("Failed to install software!");
  return;
}

// Install plugin
success = await aternosClient.InstallPluginAsync(AternosPluginProvider.Spigot, "<PLUGIN ID>", "<VERSION ID>");
if (!success) {
  Console.WriteLine("Failed to install plugin!");
  return;
}

// Delete file
success = await aternosClient.DeleteFileAsync("/plugins/Example.jar");
if (!success) {
  Console.WriteLine("Failed to delete file!");
  return;
}

// Get last server status
var lastStatus = await aternosClient.GetLastServerStatusAsync();
if (lastStatus != null) {
  Console.WriteLine($"Server name: {lastStatus.Name} | Server version: {lastStatus.Version} | Online players: {lastStatus.Players}");
}

// Get AternosLog instance
var log = await aternosClient.GetSelectedServerLogAsync();
if (log == null) {
  Console.WriteLine("Failed to fetch log object!");
  return;
}

If you want to run the unit tests create a text file called "aternos_token.txt" in your application data directory (%appdata%) with your token inside.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 291 3/27/2023
1.0.5 465 1/14/2022
1.0.4 253 1/13/2022
1.0.3 250 1/7/2022
1.0.2 240 1/7/2022
1.0.1 263 1/7/2022
1.0.0 269 1/4/2022