Example:
$ curl -k -i -u administrator@vsphere.local:password -X POST -c cookie-jar.txt https://myvcenter.mindwatering.net/rest/com/vmware/cis/session
$ curl -k -i -b cookie-jar.txt https://myvcenter.mindwatering.net/rest/vcenter/vm
Notes:
Above saves the session cookie to cookie-jar.txt so it can then use the session authentication in the cookie for the second command.
The password will be in the recent command history for the user that runs this code.
If the target uses HTTP/2, and you get a message "stream x not closed cleanly", use HTTP/1.1 instead, with --http1.1.
e.g.
curl -k -i -u administrator@vsphere.local:password -X POST -c cookie-jar.txt https://myvcenter.mindwatering.net/rest/com/vmware/cis/session --http1.1
previous page
|