{"id":20399281,"url":"https://github.com/corsinvest/cv4pve-api-java","last_synced_at":"2025-04-12T13:22:26.065Z","repository":{"id":39699837,"uuid":"103278308","full_name":"Corsinvest/cv4pve-api-java","owner":"Corsinvest","description":"Proxmox VE Client API JAVA","archived":false,"fork":false,"pushed_at":"2024-04-02T08:29:08.000Z","size":759,"stargazers_count":48,"open_issues_count":1,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-02T09:44:19.716Z","etag":null,"topics":["api","api-client","api-gateway","api-rest","cluster","eve2pve-api-java","italian","java","lxc","proxmox","proxmox-apis","proxmox-cluster","proxmox-ve","proxmoxve","pve","qemu"],"latest_commit_sha":null,"homepage":"https://www.corsinvest.it/cv4pve","language":"Java","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}},"created_at":"2017-09-12T14:03:48.000Z","updated_at":"2024-04-15T10:48:57.552Z","dependencies_parsed_at":"2023-11-07T15:31:38.763Z","dependency_job_id":"c1db1ee8-5b67-43a5-9daa-ebd969a3d7f5","html_url":"https://github.com/Corsinvest/cv4pve-api-java","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Corsinvest%2Fcv4pve-api-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Corsinvest","download_url":"https://codeload.github.com/Corsinvest/cv4pve-api-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571964,"owners_count":21126549,"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","cluster","eve2pve-api-java","italian","java","lxc","proxmox","proxmox-apis","proxmox-cluster","proxmox-ve","proxmoxve","pve","qemu"],"created_at":"2024-11-15T04:28:09.944Z","updated_at":"2025-04-12T13:22:26.038Z","avatar_url":"https://github.com/Corsinvest.png","language":"Java","readme":"# cv4pve-api-java\r\n\r\nProxmox VE Client API Java\r\n\r\n![GitHub release](https://img.shields.io/github/release/Corsinvest/cv4pve-api-java.svg)\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## Result\r\n\r\nThe result is class **Result** and contain methods:\r\n\r\n* **getResponse()** returned from Proxmox VE (data,errors,...) JSONObject .\r\n* **responseInError** (bool) : Contains errors from Proxmox VE.\r\n* **getStatusCode()** (int) : Status code of the HTTP response.\r\n* **getReasonPhrase()** (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\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* Full method generated from documentation\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.getNodes().get(\"pve1\").getQemu().vmlist().getResponse().getJSONArray(\"data\")\r\n* Return data Proxmox VE\r\n* Debug Level show to console information\r\n* Return result\r\n  * Request\r\n  * Response\r\n  * Status\r\n* Last result action\r\n* Wait task finish task\r\n  * waitForTaskToFinish\r\n  * taskIsRunning\r\n  * getExitStatusTask\r\n* Method directly access\r\n  * get\r\n  * set\r\n  * create\r\n  * delete\r\n* Login return bool if access\r\n* Return Result class more information\r\n* Minimal dependency library\r\n* ClientBase lite function\r\n* Form Proxmox VE 6.2 support Api Token for user\r\n* Login with One-time password for Two-factor authentication\r\n* Support for Proxy\r\n* Set Timeout for the Connection.\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## Usage\r\n\r\n```java\r\n//if you want use lite version only get/set/create/delete use PveClientBase\r\n\r\nPveClient client = new PveClient(\"10.92.90.91\", 8006);\r\nif (client.login(\"root\", \"password\", \"pam\")) {\r\n        //version\r\n        System.out.println(client.getVersion().version().getResponse().get(\"data\"));\r\n\r\n        // same for put/post/delete\r\n        //loop nodes for\r\n        JSONArray nodes = client.getNodes().index().getResponse().getJSONArray(\"data\");\r\n        for (int i = 0; i \u003c nodes.length(); i++) {\r\n                System.out.println(nodes.get(i));\r\n        }\r\n\r\n        //loop nodes for each\r\n        PveClient.\u003cJSONObject\u003eJSONArrayToList(client.getNodes().index().getResponse().getJSONArray(\"data\")).forEach((node) -\u003e {\r\n                System.out.println(node);\r\n        });\r\n\r\n        //loops vms qemu\r\n        JSONArray vms = client.getNodes().get(\"pve1\").getQemu().vmlist().getResponse().getJSONArray(\"data\");\r\n        for (int i = 0; i \u003c vms.length(); i++) {\r\n                System.out.println(vms.get(i));\r\n        }\r\n\r\n        //loop snapshots\r\n        JSONArray snapshots = client.getNodes().get(\"pve1\")\r\n                .getQemu().get(100).getSnapshot().snapshotList().getResponse().getJSONArray(\"data\");\r\n        for (int i = 0; i \u003c snapshots.length(); i++) {\r\n                System.out.println(snapshots.get(i));\r\n        }\r\n\r\n        //create snapshot\r\n        JSONObject retCreateSnap = client.getNodes().get(\"pve1\").getQemu().get(100).getSnapshot().snapshot(\"pippo\").getResponse();\r\n\r\n        //print UPID\r\n        System.out.println(retCreateSnap.get(\"data\"));\r\n\r\n        //wait creation\r\n        client.waitForTaskToFinish(\"pve1\", retCreateSnap.getString(\"data\"), 500, 10000);\r\n\r\n        //delete snapshot\r\n        Result retDeleSnap = client.getNodes().get(\"pve1\").getQemu().get(100).getSnapshot().get(\"pippo\").delsnapshot();\r\n        System.out.println(retDeleSnap.getResponse().get(\"data\"));\r\n}\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorsinvest%2Fcv4pve-api-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorsinvest%2Fcv4pve-api-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorsinvest%2Fcv4pve-api-java/lists"}