{"id":13521525,"url":"https://github.com/Corsinvest/cv4pve-api-dotnet","last_synced_at":"2025-03-31T20:31:42.684Z","repository":{"id":24693907,"uuid":"102229030","full_name":"Corsinvest/cv4pve-api-dotnet","owner":"Corsinvest","description":"Proxmox VE Client API .Net C#","archived":false,"fork":false,"pushed_at":"2025-03-21T18:06:04.000Z","size":1304,"stargazers_count":67,"open_issues_count":0,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T14:14:43.725Z","etag":null,"topics":["api","api-client","api-gateway","api-rest","dotnet","dotnet-core","dotnet-standard","enterprise","lxc","nuget","proxmox","proxmox-apis","proxmox-cluster","proxmox-ve","proxmoxve","pve","qemu","web-api"],"latest_commit_sha":null,"homepage":"https://www.corsinvest.it/cv4pve","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Corsinvest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-02T23:22:50.000Z","updated_at":"2025-03-21T18:06:09.000Z","dependencies_parsed_at":"2024-01-13T22:23:26.964Z","dependency_job_id":"b66503cd-247e-423c-a77f-b19823b151e1","html_url":"https://github.com/Corsinvest/cv4pve-api-dotnet","commit_stats":{"total_commits":131,"total_committers":5,"mean_commits":26.2,"dds":0.5114503816793894,"last_synced_commit":"9a1e45318e15784d22a6e43d8063b56e5e34029f"},"previous_names":["enterpriseve/eve2pve-api-dotnet"],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Corsinvest","download_url":"https://codeload.github.com/Corsinvest/cv4pve-api-dotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246535994,"owners_count":20793363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","api-gateway","api-rest","dotnet","dotnet-core","dotnet-standard","enterprise","lxc","nuget","proxmox","proxmox-apis","proxmox-cluster","proxmox-ve","proxmoxve","pve","qemu","web-api"],"created_at":"2024-08-01T06:00:35.544Z","updated_at":"2025-03-31T20:31:42.293Z","avatar_url":"https://github.com/Corsinvest.png","language":"C#","funding_links":[],"categories":["🔧 API \u0026 SDKs"],"sub_categories":["💻 Language-Specific Libraries"],"readme":"# Corsinvest.ProxmoxVE.Api\r\n\r\n[![Nuget](https://img.shields.io/nuget/v/Corsinvest.ProxmoxVE.Api.svg?label=Nuget%20%20Api)](https://www.nuget.org/packages/Corsinvest.ProxmoxVE.Api) [![Nuget](https://img.shields.io/nuget/v/Corsinvest.ProxmoxVE.Api.Extension.svg?label=Nuget%20%20Extension)](https://www.nuget.org/packages/Corsinvest.ProxmoxVE.Api.Extension) [![Nuget](https://img.shields.io/nuget/v/Corsinvest.ProxmoxVE.Api.Metadata.svg?label=Nuget%20%20Metadata)](https://www.nuget.org/packages/Corsinvest.ProxmoxVE.Api.Metadata) [![Nuget](https://img.shields.io/nuget/v/Corsinvest.ProxmoxVE.Api.Shell.svg?label=Nuget%20%20Shell)](https://www.nuget.org/packages/Corsinvest.ProxmoxVE.Api.Shell) [![Nuget](https://img.shields.io/nuget/v/Corsinvest.ProxmoxVE.Api.Shared.svg?label=Nuget%20%20Shared)](https://www.nuget.org/packages/Corsinvest.ProxmoxVE.Api.Shared)\r\n\r\nProxmox VE Client API .Net\r\n\r\n[Proxmox VE Api](https://pve.proxmox.com/pve-docs/api-viewer/)\r\n\r\n```text\r\n   ______                _                      __\r\n  / ____/___  __________(_)___ _   _____  _____/ /_\r\n / /   / __ \\/ ___/ ___/ / __ \\ | / / _ \\/ ___/ __/\r\n/ /___/ /_/ / /  (__  ) / / / / |/ /  __(__  ) /_\r\n\\____/\\____/_/  /____/_/_/ /_/|___/\\___/____/\\__/\r\n\r\nCorsinvest for Proxmox VE Api Client  (Made in Italy)\r\n```\r\n\r\n## Copyright and License\r\n\r\nCopyright: Corsinvest Srl\r\nFor licensing details please visit [LICENSE](LICENSE)\r\n\r\n## Commercial Support\r\n\r\nThis software is part of a suite of tools called cv4pve-tools. If you want commercial support, visit the [site](https://www.corsinvest.it/cv4pve)\r\n\r\n## General\r\n\r\nThe client is generated from a JSON Api on Proxmox VE.\r\n\r\n## Main features\r\n\r\n* Easy to learn\r\n* Method named\r\n* Implementation respect the [Api structure of Proxmox VE](https://pve.proxmox.com/pve-docs/api-viewer/)\r\n* Set ResponseType json, png\r\n* Full class and method generated from documentation (about client)\r\n* Comment any method and parameters\r\n* Parameters indexed eg [n] is structured in array index and value\r\n* Tree structure\r\n  * client.Nodes[\"pve1\"].Qemu[100].Snapshot().snapshotList().Response.data\r\n* Return data Proxmox VE\r\n* Logger with MicrosMicrosoft.Extensions.Logging\r\n* Return result\r\n  * Request\r\n  * Response\r\n  * Status\r\n* Last result action\r\n* Task utility\r\n  * WaitForTaskToFinish\r\n  * TaskIsRunning\r\n  * GetExitStatusTask\r\n* Method direct access\r\n  * Get\r\n  * Create (Post)\r\n  * Set (Put)\r\n  * Delete\r\n* Login return bool if access\r\n* Return Result class more information\r\n* ClientBase lite function\r\n* Form Proxmox VE 6.2 support Api Token for user\r\n* Async / Await\r\n* Add model in Shared library for decode json\r\n* Add Extension method **Get** to decode in json from result in Extension library\r\n* Login with One-time password for Two-factor authentication\r\n* Set Timeout for the Connection.\r\n* Validate certificate SSL, default not validate\r\n\r\n## Api token\r\n\r\nFrom version 6.2 of Proxmox VE is possible to use [Api token](https://pve.proxmox.com/pve-docs/pveum-plain.html).\r\nThis feature permit execute Api without using user and password.\r\nIf using **Privilege Separation** when create api token remember specify in permission.\r\nFormat USER@REALM!TOKENID=UUID\r\n\r\n## Result\r\n\r\nThe result is class **Result** and contain properties:\r\n\r\n* **Response** returned from Proxmox VE (data,errors,...) dynamic [ExpandoObject](https://msdn.microsoft.com/en-US/library/system.dynamic.expandoobject(v=vs.110).aspx)\r\n* **ResponseToDictionary** return response to dictionary ```IDictionary\u003cString, object\u003e```\r\n* **ResponseInError** (bool) : Contains errors from Proxmox VE.\r\n* **StatusCode** (System.Net.HttpStatusCode): Status code of the HTTP response.\r\n* **ReasonPhrase** (string): The reason phrase which typically is sent by servers together with the status code.\r\n* **IsSuccessStatusCode** (bool) : Gets a value that indicates if the HTTP response was successful.\r\n* **GetError()** (string) : Get error.\r\n\r\nExample result:\r\n\r\n```json\r\n{\r\n  \"data\": {\r\n    \"smbios1\": \"uuid=9246585e-0c8b-4d02-8fe2-f48fd0da3975\",\r\n    \"ide2\": \"none,media=cdrom\",\r\n    \"onboot\": 1,\r\n    \"boot\": \"cdn\",\r\n    \"cores\": 2,\r\n    \"agent\": 1,\r\n    \"memory\": 4096,\r\n    \"numa\": 0,\r\n    \"bootdisk\": \"virtio0\",\r\n    \"sockets\": 1,\r\n    \"net0\": \"virtio=3A:39:38:30:36:31,bridge=vmbr0\",\r\n    \"parent\": \"auto4hours170904080002\",\r\n    \"digest\": \"acafde32daab50bce801fef2e029440c54ebe2f7\",\r\n    \"vga\": \"qxl\",\r\n    \"virtio0\": \"local-zfs:vm-100-disk-1,cache=writeback,size=50G\",\r\n    \"ostype\": \"win8\",\r\n    \"name\": \"phenometa\"\r\n  }\r\n}\r\n```\r\n\r\n## Usage\r\n\r\n```C#\r\n//if you want use lite version only get/set/create/delete use PveClientBase\r\n\r\nvar client = new PveClient(\"10.92.90.91\");\r\nif (await client.Login(\"root\", \"password\"))\r\n{\r\n    var vm = await client.Nodes[\"pve1\"].Qemu[100];\r\n\r\n    //config vm\r\n    var config = await vm.Config.VmConfig();\r\n    Console.WriteLine(JsonConvert.SerializeObject(config.Response,Formatting.Indented));\r\n\r\n    //create snapshot\r\n    var response = await vm.Snapshot.Snapshot(\"pippo2311\");\r\n\r\n    //update snapshot description\r\n    await vm.Snapshot[\"pippo2311\"].Config.UpdateSnapshotConfig(\"description\");\r\n\r\n    //delete snapshot\r\n    await vm.Snapshot[\"pippo2311\"].Delsnapshot();\r\n\r\n    //list of snapshot\r\n    foreach (var snapshot in (await vm.Snapshot.SnapshotList()).Response.data)\r\n    {\r\n        Console.WriteLine(JsonConvert.SerializeObject(snapshot,Formatting.Indented));\r\n        Console.WriteLine(snapshot.name);\r\n    }\r\n\r\n    //change response type from json to png\r\n    client.ResponseType = \"png\";\r\n    var dataImg = client.Nodes[\"pve1\"].Rrd.Rrd(\"cpu\", \"day\").Response;\r\n    Console.WriteLine(\"\u003cimg src=\\\"{dataImg}\\\" \\\u003e\");\r\n}\r\n\r\n//using Api Token\r\nvar client = new PveClient(\"10.92.100.33\");\r\nclient.ApiToken = \"root@pam!qqqqqq=8a8c1cd4-d373-43f1-b366-05ce4cb8061f\";\r\nvar version = await client.Version.Version();\r\nConsole.WriteLine(JsonConvert.SerializeObject(version.Response.data, Formatting.Indented));\r\n```\r\n\r\n## Corsinvest.ProxmoxVE.Extension\r\n\r\nExtension add functionality on Api.\r\n\r\n* ApiExplorer\r\n* Retrive VM/CT data from name or id\r\n* Simplify management of VM/CT e.g snapshot\r\n* Extension method **Get** to decode json from result\r\n  e.g Client.Cluster.Status.Get() return **IEnumerable\u003cIClusterStatus\u003e**\r\n\r\n## Corsinvest.ProxmoxVE.Shared\r\n\r\nContain model for Json conversion and utility.\r\n\r\n## Corsinvest.ProxmoxVE.Metadata\r\n\r\nRead documentation ProxmoxVE API and extract structure.\r\n\r\n## Corsinvest.ProxmoxVE.Shell\r\n\r\nUtility for console application.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCorsinvest%2Fcv4pve-api-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCorsinvest%2Fcv4pve-api-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCorsinvest%2Fcv4pve-api-dotnet/lists"}