Here you can find a .NET library for the Hetzner Cloud API, with which all functions of the endpoints can be used.
The current version is provided as .NET Standard 2.0, currently I am working on a new version for .NET 6 (with features like dependency injection, etc.)
see the getting started page here https://github.com/lk-code/hetzner-cloud-api-net/wiki/getting-started
see the demo projects here https://github.com/lk-code/hetzner-cloud-api-net-demo
see the documentation on https://github.com/lk-code/hetzner-cloud-api-net/wiki
see the demo projects here https://github.com/lk-code/hetzner-cloud-api-net-demo
The v3 client is currently only available as a prerelease. Accordingly, the "Include Prerelease" flag must be set in the NuGet search.
dotnet add package hetznercloudapi
add the following block to your AppSettings:
{
"HetznerCloud": {
"ApiToken": "YOUR_API_TOKEN"
}
}
Alternatively, the API token can also be set dynamically:
IHetznerCloudService _hetznerCloudService = {get instance via DI};
...
_hetznerCloudService.LoadApiToken("{YOUR_API_TOKEN}");
Access via IServerService
Definition:
Task<Page<Server>> GetAllAsync(int page = 1,
int itemsPerPage = 25,
List<IFilter>? filter = null,
Sorting<ServerSortField>? sorting = null,
CancellationToken cancellationToken = default);