While I was trying to GET group's 1000 threads using Microsoft Graph API on PowerShell, 504 gateway error is happening and the code stopped.
But if I re-execute the code without any change, it ran well. Why this happens and how should I avoid this issue?
$apiUrl53 = "https://graph.microsoft.com/beta/groups/" + $groups.id + "/threads?top=1000"
$Data = Invoke-WebRequest -Headers $global:__authHeader -Uri $apiUrl53 -Method Get
Error Message :
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand