Hello team,
I'm trying to write a script that executes a powershell script
1st API call works well and I can obtain a list of the VMs and associated GUID
$response = Invoke-RestMethod -Uri "$cvApiUrl/v4/virtualmachines" -Method Get -Headers $cvHeadersGet -UseBasicParsing
for the second step of the script I am getting details of the VMs and store them on a table.
foreach ($vm in $allVMs) {
$uuid = $vm.UUID
$vmName = $vm.name
Write-Host "--- Processing VM : $vmName ---"
Write-Host "URL : $cvApiUrl/VM?guid=$uuid"
try {
$vmDetail = Invoke-RestMethod -Uri "$cvApiUrl/VM?guid=$uuid" -Method Get -Headers $cvHeadersGet -UseBasicParsing
After 90 call I got this error
WARNING: Erreur récupération détail VM VM1 (attempt1) : The underlying connection was closed: An unexpected error occurred on a send.
WARNING: Erreur récupération détail VM VM2 (attempt2) : The underlying connection was closed: An unexpected error occurred on a send.
WARNING: Erreur récupération détail VM VM3 (attempt3) : The underlying connection was closed: An unexpected error occurred on a send.
Do you know if there is a limitation for API calls ?
I have also tried to renew the token after 50 VM but same
I have tried to put a wait between each call 10s, same issue :(
Your help would be appreciated !
Thanks
