vCenter REST API 사용 방법
vSphere Client 버전 6.7.0.20000
apiexplorer
apiexplorer
에 액세스하면 REST API 참조를 볼 수 있습니다.https://<vCenter IP or FQDN>/apiexplorer/
TRY IT OUT!
를 클릭하면 실제로 vCenter에서 API를 실행해 볼 수 있습니다.※ 상기는 header내의
session-id
가 null가 되어 있기 때문에, 인증 에러가 된다.curl로 API 실행
$ curl --insecure -X POST -u <your-id>:<your-password> \
https://<vCenter IP or FQDN>/rest/com/vmware/cis/session
{"value":"d8da17d7cba6677d67a271873666eecf"}
$ curl -X GET --header "Accept: application/json" --header \
"vmware-api-session-id: d8da17d7cba6677d67a271873666eecf" \
"https://<vCenter IP or FQDN>/rest/vcenter/vm" -k
$ export session_id=`curl --insecure -X POST -u 'user:pass' https://<vCenter IP or FQDN>/rest/com/vmware/cis/session | python3 -c "import sys, json; print(json.load(sys.stdin)['value'])"`
$ curl -k -X GET --header "Accept: application/json" --header "vmware-api-session-id: $session_id" "https://<vCenter IP or FQDN>/rest/vcenter/vm" | python3 -m json.tool
참고: vCenter REST-API 목록
rest-api
cluster
datacenter
datastore
datastore/default_policy
deployment
deployment/import_history
deployment/install
deployment/install/initial_config/remote_psc/thumbprint
deployment/install/psc/replicated
deployment/install/psc/standalone
deployment/install/remote_psc
deployment/question
deployment/upgrade
folder
guest/customization_specs
호스트
inventory/datastore
inventory/network
iso/image
네트워크
ovf/capability
ovf/export_flag
ovf/import_flag
ovf/library_item
resource_pool
services/service
storage/policies
storage/policies/compliance
storage/policies/compliance/VM
storage/policies/VM
system_config/deployment_type
system_config/psc_registration
vcha/capabilities
vcha/cluster
vcha/cluster/active
vcha/cluster/deployment_type
vcha/cluster/mode
vcha/cluster/passive
vcha/cluster/witness
vcha/operations
vcha/vc_credentials
VM
vm_template/library_items
vm/guest/identity
vm/guest/local_filesystem
vm/guest/power
vm/hardware
vm/hardware/adapter/sata
vm/hardware/adapter/scsi
vm/hardware/boot
vm/hardware/boot/device
vm/hardware/cdrom
vm/hardware/cpu
vm/hardware/disk
vm/hardware/ethernet
vm/hardware/floppy
vm/hardware/memory
vm/hardware/parallel
vm/hardware/serial
vm/power
vm/storage/policy
vm/storage/policy/compliance
Reference
이 문제에 관하여(vCenter REST API 사용 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/hmtk715/items/4c793be3c40f3d20c31c텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)