Created
April 24, 2020 15:08
-
-
Save goneri/93af017a686bd7be39c411d31f92c533 to your computer and use it in GitHub Desktop.
Example of interaction with a vCenter with curl and the REST API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
server='https://vcenter.test' | |
password='z!Zq4Y&`/!E(o<br?:L>' | |
session_id=$(curl -q -X POST -k -u "administrator@vsphere.local:${password}" ${server}/rest/com/vmware/cis/session|jq -r .value) | |
for i in $(seq 10); do | |
curl -ik -H 'Accept:application/json' -H "vmware-api-session-id:${session_id}" -X GET ${server}/rest/vcenter/cluster | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment