Skip to content

Corsinvest.ProxmoxVE.Api

The client. It is the only package an application needs to call the Proxmox VE API; the others build on it.

dotnet add package Corsinvest.ProxmoxVE.Api

NuGet · targets .NET 8, 9 and 10.

Type For
PveClient The whole API as a tree of properties, indexers and methods, generated from the Proxmox VE API schema: API structure
PveClientBase What PveClient derives from: connection, login, the four raw calls, task helpers. Usable on its own when only raw calls are needed
Result The outcome of every call: Results
ResultExtension ToData(), ToEnumerable(), ToModel<T>(), ToLogs(), InError()
PveResultException, PveAuthenticationException The exceptions of the few methods that throw: Errors
ResponseType, MethodType JSON or PNG answers; the four kinds of call
using Corsinvest.ProxmoxVE.Api;
var client = new PveClient("pve01")
{
ApiToken = Environment.GetEnvironmentVariable("PVE_API_TOKEN")
};
var result = await client.Cluster.Resources.Resources(type: "vm");
if (!result.IsSuccessStatusCode)
{
Console.Error.WriteLine($"{(int)result.StatusCode} {result.ReasonPhrase}");
return 1;
}
foreach (var guest in result.ToEnumerable().OrderBy(a => a.vmid))
{
Console.WriteLine($"{guest.vmid,6} {guest.type,-5} {guest.node,-10} {guest.status}");
}
return 0;

The client reads the answers with Newtonsoft.Json and logs through Microsoft.Extensions.Logging. It does not depend on the other packages of this repository.