Proxmox API JSONSchema

florian7843

New Member
Feb 11, 2024
3
0
1
Austria
Hi,

I am trying to build a TypeScript impementation of the API, and would like to use the JSONSchema to automatically build the the implementation from it.

For that I would need the schema of the API. I only found [pve-docs.git] / api-viewer / apidata.js. I think I would be able to work with that. However, to me it seems like this is already something generated from the actual schema. Please correct me if I am wrong, but I don't want to start with the wrong implementation.

Kind regards
Florian
 
Hi,
For that I would need the schema of the API. I only found [pve-docs.git] / api-viewer / apidata.js. I think I would be able to work with that. However, to me it seems like this is already something generated from the actual schema. Please correct me if I am wrong, but I don't want to start with the wrong implementation.
yes, it's auto-generated. The schema is sprinkled throughout the Perl code, but can be dumped and converted to JSON like here: https://git.proxmox.com/?p=pve-docs...4f17b95de4e1fc0a73445eb7877ea13b406a0;hb=HEAD
You can run the PVE::RESTHandler::api_dump_remove_refs or one of the other dump methods in a PVE installation to get its API:
https://git.proxmox.com/?p=pve-comm...=c6ec71d846001dea6b923bc3b95682caf6a25c16#l87
For how the schema is actually implemented see: https://git.proxmox.com/?p=pve-comm...4;hb=c6ec71d846001dea6b923bc3b95682caf6a25c16