Hi,
I'm trying to automate the renewal of the VCenter TLS certificate via REST API.
Getting an error message when sending the certs via curl
curl -X PUT -H "vmware-api-session-id: sessionid" -H "Content-Type: application/json" -d '{"cert":"cert.crt","key":"cert.key","root_cert":"root-ca.crt"}' https://vcenter/api/vcenter/certificate-management/vcenter/tls
{"error_type":"ERROR","messages":[{"args":["String index out of range: -1"],"default_message":"Exception found (String index out of range: -1)","id":"com.vmware.certificatemanagement.error"}]}
Anyone ever seen this?
thx
best regards, Karsten
I don't know if someone here has replaced Cert via restapi. Probably all done in a standard way via GUI or SSH.
If you look at the vSphere REST API documentation https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/api/vcenter/certificate-manageme..., the value for the certificate is NOT the file itself but rather the contents of the file, hence the string format