Quick Overview of Proxmox VE REST API

#Promox #API #Hypervisor
Full steps can be found at i12bretro.github.io/tutorials...
Creating An API User
01. Log into the Proxmox VE web UI
02. Select Datacenter from the left navigation menu
03. Select Users from the left sub-navigation menu
04. Click the Add button at the top of the main content area
05. Enter the Username API, set the Realm to Proxmox VE authentication server and set and confirm a password ≫ Click Add
06. Select API Tokens from the left sub-navigation menu
07. Select API@pve for the username
08. Enter a secret key into the Token ID field ≫ Click Add
TIP: Use a random string generator to create a unique Token ID www.random.org/passwords/?num...
09. Copy the displayed Token ID and Secret to a text document for use later
10. Close the dialog
11. Select Roles from the left sub-navigation menu
12. Click the Create button at the top of the main content area
13. Name the new role APIAdmin and select all available Privileges ≫ Click Create
NOTE: These permissions can be fine-tuned later
INFO: More information on each privilege can be found pve.proxmox.com/pve-docs/pve-...
14. Select Permissions from the left sub-navigation menu
15. Select the Add ≫ User permission at the top of the main content area
16. Set the Path to /, select the API@pve user and set the Role to APIAdmin ≫ Click Add
Downloading Postman
Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs-faster. - postman.com
01. Download Postman github.com/portapps/postman-p...
02. Extract or install Postman
03. Launch Postman
04. Click the Skip and go to app link at the bottom left of the splash screen
05. Select File ≫ Settings from the top menu bar
06. Disable SSL Certificate Verification and Send anonymous usage data to Postman ≫ Close the Settings dialog window
Proxmox API Authentication
01. In Postman, click the + next to the Overview tab to create a new HTTP request tab
02. Complete the HTTP Request form as follows:
- Method: POST
- URL: DNSorIP:8006/api2/json/access/ticket
- Body: x-www-form-urlencoded
• username: API@pve
• password: ≪API@pve Password≫
08. Click the Send button
09. From the response, copy the ticket value and CSRFPreventionToken values to a text document for use later
Proxmox Version API Call
01. In Postman, click the + next to the Overview tab to create a new HTTP request tab
02. Click the Cookies link below the send button
03. Type the API URL up to /json/, (ie DNSorIP:8006/api2/json/) ≫ Click Add
04. Click Add Cookie
05. Replace the Cookie_1 key with PVEAuthCookie
06. Replace the value with the ticket value from authentication response, the result should look like
PVEAuthCookie=PVE:API@pve:611F9752::aXrYKYqiv8oV/MetlZl6FC40HSULSj4gt9EjDsTIwq+GXVXpkGyqvMlXqmGP6LP/rUYUgIKkSh9ioEhz91kR9/i+jDobDFIAtjBGLIP4yJVbxbtU6hfJL91YQNyYgvHqkPv4/W6EYWir5+LFQc3womgqVE9gKApk61J8zxFNTTjwh87HbMAtv12fvAqiICEqRMdqvE6ySJF5a8E+rOlqa46MlTbUTnzCbqPTY6tWBYHryy8WS8Typ3aSkOKecup18sCBtzqxnkm9bpws+f8vW9FdJV8eKnR+MbFLQtv/re5Cw/J7RpdvcQvMsZ0JLFWqnTaPgRzBc/mM7xZBKeCiSA==
07. Click Save ≫ Close the Manage Cookies dialog window
08. Complete the HTTP Request form as follows:
- Method: GET
- URL: DNSorIP:8006/api2/json/version
- Headers:
• CSRFPreventionToken: ≪CSRFPreventionToken value from authentication response≫
13. Click the Send button
14. The response body should show details about the current Proxmox version
Proxmox Nodes API Call
01. In Postman, right click the /version HTTP request tab ≫ Duplicate Tab
02. Change the URL to DNSorIP:8006/api2/json/nodes
03. Click the Send button
04. The response body should show details about the available Proxmox node(s)
Proxmox Node Status API Call
01. In Postman, right click the /version HTTP request tab ≫ Duplicate Tab
02. Change the URL to DNSorIP:8006/api2/json/nodes/≪node name≫/status
03. Click the Send button
04. The response body should show details about the selected Proxmox node
Simple PHP API Communication Demo raw.githubusercontent.com/i12...
Proxmox VE API Wiki: pve.proxmox.com/wiki/Proxmox_...
Proxmox VE Visual API Reference: pve.proxmox.com/pve-docs/api-...
Connect with me and others ###
★ Discord: / discord
★ Reddit: / i12bretro
★ Twitter: / i12bretro

Пікірлер: 21

  • @ahmedw5
    @ahmedw5 Жыл бұрын

    This was very helpful, thank you!

  • @i12bretro

    @i12bretro

    Жыл бұрын

    Glad to hear it. Thanks for the comment

  • @RM-gm7lu
    @RM-gm7lu Жыл бұрын

    Thanks for sharing the KNOWLEDGE!! won a subscriber.

  • @i12bretro

    @i12bretro

    Жыл бұрын

    You're welcome and thanks for the comment

  • @Gunslinger088
    @Gunslinger088 Жыл бұрын

    Thank you!!

  • @i12bretro

    @i12bretro

    Жыл бұрын

    You're welcome, enjoy!

  • @hasan1578
    @hasan1578 Жыл бұрын

    Excellent

  • @i12bretro

    @i12bretro

    Жыл бұрын

    Thanks

  • @Mega-gb1yk
    @Mega-gb1yk2 жыл бұрын

    disable cors ?

  • @amineflex1337
    @amineflex13372 жыл бұрын

    you saved me

  • @i12bretro

    @i12bretro

    2 жыл бұрын

    Glad it was helpful. Thanks for the comment

  • @vklab24
    @vklab242 ай бұрын

    This is great! Would you be able to run a video for ProxMox to work with Tailscale. I really wanted to use it outside my home - like from the phone

  • @i12bretro

    @i12bretro

    2 ай бұрын

    I have a video on Tailscale in the works. I've been using it for months and love the simplicity

  • @vklab24

    @vklab24

    2 ай бұрын

    @@i12bretro I'll look into this! Coming from the bottom and enjoying your videos! You're great and share amazing content! I learned quite a lot with your videos! Looking for the Tailscale ;)

  • @f.bell.9761
    @f.bell.9761 Жыл бұрын

    Hi, first : thanks for sharing, then why did you generate API token as you don't use it?

  • @i12bretro

    @i12bretro

    Жыл бұрын

    I didn't use it in my demo, but they can be used as another means to authenticate with the API pve.proxmox.com/wiki/Proxmox_VE_API#API_Tokens

  • @f.bell.9761

    @f.bell.9761

    Жыл бұрын

    @@i12bretro Thanks for your very fast answer !! I have to admit I'm struggeling with them. Do you know if we can use the PVEAPIToken to authenticate in a web browser or to generate a ticket and get tthe cookie and CSRFPreventionToken?

  • @i12bretro

    @i12bretro

    Жыл бұрын

    You can use the PVEAPIToken by itself without needing a ticket or CSRF token. Just set the authorization header in the curl execution. Just note, anyone that has the api token can effectively do anything the user has rights to do in PVE, so keep it safe

  • @f.bell.9761

    @f.bell.9761

    Жыл бұрын

    @@i12bretro hmm, I know this. My purpose is to authenticate with a browser using cookie or something else. I can get cookie within ticket using login and pass and i'm able login with but I did not found a way to get that cookie (or full ticket) using PVEAPIToken or even directly authenticate using PVEAPIToken. I hoped you may be know something about this ;-)

  • @i12bretro

    @i12bretro

    Жыл бұрын

    How are you making the API call in your page?