We need to get the api session ID & Cluster ID to make this API request:
How to get the cluster id (.i.e - Domain-xx)-:
dcli> vcenter namespaces namespaceselfservice list
|---------|----------|-----------|
|cluster |capability|status |
|---------|----------|-----------|
|domain-c8|SUPPORTED |DEACTIVATED|
|---------|----------|-----------|
curl -X POST -H "vmware-api-session-id:xxxxxxx" https://<vcenter IP>/api/vcenter/namespace-management/clusters/domain-xx?action=rotate_password --insecure
For more information on API you can refer to this doc https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/api/vcenter/namespace-management/clusters/clusteractionrotate_password/post/