Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of interaction with a vCenter with curl and the REST API.
#!/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