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>