[API] How to get new ticket ?

GospodinAbdula

New Member
Jul 25, 2014
22
0
1
Hello! I need get new ticket use old ticket only, not password.
i use API for monitoring qm.

auth in API:

Code:
curl -k --data "username=root&password=toor&realm=pam" https://localhost:8006/api2/extjs/access/ticket

Tickets have a limited lifetime of 2 hours.

Can you say me how to get new ticket?

I readed in wiki - http://pve.proxmox.com/wiki/Proxmox_VE_API

NOTE: Tickets have a limited lifetime of 2 hours. But you can simple get a new ticket by passing the old ticket as password to the /access/ticket method.

i tried:

Code:
curl -s -k -b "PVEAuthCookie=PVE:root@pam:5.....+Xtdd+qS3iCkQ==" https://localhost:8006/api2/extjs/access/ticket

and

Code:
curl -s -k -d "username=root&password=PVE:root@pam:5.....+Xtdd+qS3iCkQ==&realm=pam" https://localhost:8006/api2/extjs/access/ticket

But it didnt work!

Please help me!
 
Last edited:
Code:
curl -s -k -d "username=root&password=PVE:root@pam:5.....+Xtdd+qS3iCkQ==&realm=pam" https://localhost:8006/api2/extjs/access/ticket

But it didnt work!

Looks correct to me. You need to call that before the ticket expires.

What error message to you get exactly?
 
Looks correct to me. You need to call that before the ticket expires.

What error message to you get exactly?

Yes I do it before the expiration

If i send command without parameter realm=pam in --data

root@proxmox:~# curl -k --data "username=root&password=PVE:root@pam:53D5D......36sgiXA==" https://localhost:8006/api2/extjs/access/ticket
{"success":0,"status":500,"data":null,"message":"value 'root' does not look like a valid user name\n"}

if i add parameter realm=pam to data

root@proxmox2:~# curl -k --data "realm=pam&username=root&password=PVE:root@pam:53D5.....sgiXA==" https://localhost:8006/api2/extjs/access/ticket
{"success":0,"status":500,"data":null,"message":"Authentication failure\n"}
 
You need to correctly encode (--data-urlencode) parameters, for example:

Code:
 curl -k --data "username=root" --data "realm=pam" --data-urlencode "password=PVE:root@pam:53D73D28::Mxcq/v+X...jdg==" https://lola:8006/api2/extjs/access/ticket
 
  • Like
Reactions: kwinz
You need to correctly encode (--data-urlencode) parameters, for example:

Code:
 curl -k --data "username=root" --data "realm=pam" --data-urlencode "password=PVE:root@pam:53D73D28::Mxcq/v+X...jdg==" https://lola:8006/api2/extjs/access/ticket


Its work! Thank you! ;)