No ticket for url on any api endpoints with API Token or access ticket

mark7888

New Member
Aug 8, 2024
2
0
1
I have freshly installed a Proxmox VE on a running Debian12 machine, everything works just fine, but i have some problems with the API.

Python:
import requests
import json

proxmox_url = "http://localhost:8006/api2/json"
node = "debian"

auth_token = "PVEAPIToken=root@pam!mytokenid=0000aaa0-aa00-000a-0aaa-0aaa00a000a0"

headers = {
    "Authorization": auth_token,
}

response = requests.get(f"{proxmox_url}/nodes", headers=headers, verify=False)
response.raise_for_status()

resp = response.json()
print(json.dumps(resp, indent=4))


But whatever i do, i get an error:

Code:
requests.exceptions.HTTPError: 401 Client Error: No ticket for url: https://localhost:8006/api2/json/nodes

Also tried using the ticket from /access/ticket, I successfully get back the ticket and the CSRFPreventionToken, but executing any API calls with them results in the same error message as above.

Proxmox Virtual Environment 8.2.4
 
tested your script (with my token entered) and got the same error

i noticed you use 'http://' instead of 'https://'. after i fixed that, it works.
maybe the redirection from http -> https causes the python lib to drop the auth header?
 
  • Like
Reactions: mark7888

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!