PROXMOX API ::: How to pass Authentication parameters

phoneme

New Member
May 19, 2020
10
0
1
29
Hi,

I am new to the proxmox API and would like to consume this feature to generate an alert when the VM in the Proxmox environment crosses a min thresh hold .
I am using the Python with requests library but dont know the correct way to pass on the authentication parameters while placing the GET requests.

---------------------------------------------- try.py ------------------------------------------------------------------------------------------------------------------------
import requests
import urllib
import json
from datetime import datetime

r=requests.get("https://172.16.15.31:8006/api2/json/nodes/pve31/qemu/116/agent/network-get-interfaces",verify=False)
print(r)






Response
__________

root@pve1:~# python /etc/ansible/try.py
/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
<Response [401]>

Please suggest the proper way to pass the authentication parameters .

Regards

Anuj
 
you can also use API tokens if your PVE system is recent enough, those don't need a login/ticket but can just be passed as 'Authorization' header.

Do you have any details on this? I've been hunting for documentation with no success... I'd like to pass an API token instead of a username / password etc...
 
Ahhhh awesome - I did finally run across this - I just didn't quite understand what format I needed to pass the token in...

I've got this configured properly now and allows us to use our deployment scripting for images from https://vorteil.io

Now we can also do our normal shell scripts for running nodes and start / stop / shutdown and with a bit of our internal magic, update the KVM raw image file from our build system on the fly...
 
  • Like
Reactions: fabian

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!