Loading...
「ツール」は右上に移動しました。
利用したサーバー: natural-voltaic-titanium
204いいね 16437回再生

Quick Overview of Proxmox VE REST API

#Promox #API #Hypervisor

Full steps can be found at i12bretro.github.io/tutorials/0572.html

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=1&len=24&format=plai…
   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-admin-guide.html#pveu…
   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-portable/releases
   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: https://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 https://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: https://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 https://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 https://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/i12bretro/tutorials/main…
 
Proxmox VE API Wiki:  pve.proxmox.com/wiki/Proxmox_VE_API
Proxmox VE Visual API Reference:  pve.proxmox.com/pve-docs/api-viewer/index.html
 


Connect with me and others ###
★ Discord: discord.com/invite/EzenvmSHW8
★ Reddit: reddit.com/r/i12bretro
★ Twitter: twitter.com/i12bretro

コメント