Box API call via Powershell | Invoke-RestMethod : The operation has timed out
I have inherited a workflow that has a powershell script to transfer / delete Box accounts for termed users. It seems to run into issues when it makes an API to query the source / target user ID, and when transferring content, or deleting the account. It's the timeouts that concerns me the most, since they are not logged with the way the script is currently setup, e.g.
Side by Side comparison, same script running a process against same user - Top: Failed | Bottom: Successful
Code snippets:
# Query this SRC user in Box to get user ID
$qryBoxSrcUserAPI=Invoke-RestMethod -Uri "https://api.box.com/2.0/users?filter_term=$($sqlUpdate.boxSrcAcct)&limit=1" -method "GET" -Headers @{"Authorization"="Bearer $($cfgBoxAPItoken)"}
Write-Host "BOX SRC USER ID: " $thisSrcUser_id
# Transfer content
$qryBoxUserTransferFolderAPI=Invoke-RestMethod -Uri "https://api.box.com/2.0/users/$($thisSrcUser_id)/folders/0" -method "PUT" -Headers @{"Authorization
"="Bearer $($cfgBoxAPItoken)"} -Body $jsonSet -ContentType "application/json"
Invoke-RestMethod : The operation has timed out
At line:1 char:30
+ $qryBoxUserTransferFolderAPI=Invoke-RestMethod -Uri "https://api.box.com/2.0/use ...
+ CategoryInfo : NotSpecified: (:) [Invoke-RestMethod], WebException
Please sign in to leave a comment.
Comments
0 comments