Api access returns 401

prad81

New Member
Sep 9, 2023
6
1
3
Hi I'm writing an application with PHP and looking to integrate with Proxmox, I'm having trouble accessing the API (such as /api2/json/nodes).

As a test, here are the steps that I had undertaken :
- Created a new user in the realm PVE called API
- Created a new role called APIrole with every single privilege that was available (for testing purposes)
- Created a API token for the use API
- In permissions I've done both User Permission and API Token Permisson with path /

I'm using Yaak (like postman) to call the api, https://<proxmoxip>:8006/api2/json/nodes, with one item in the header : Authorization with the value API@pve!FLSWu9RrjyscvBYVFRrE9QCj

What am I doing incorrectly here, in the https://pve.proxmox.com/wiki/Proxmox_VE_API it states the format needs to be
PVEAPIToken=USER@REALM!TOKENID=UUID
however, the example is different (curl -H "Authorization: PVEAPIToken=root@pam!monitoring=aaaaaaaaa-bbb-cccc-dddd-ef0123456789" https://10.0.0.1:8006/api2/json/).

- The questions I have is am I construting the token correctly
- In the format suggested what is UUID ?
- in the example provided it has "monitoring" is that TOKENID ?

Thanks
 
ok I've got a 200 now, just in case anyone else is looking at this - UUID is the secret that you are provided. The format is
PVEAPIToken=<USER>@<REALM>!<TOKENID>=<SECRET>
 

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!