legal hold assignment api call returning "404" not found
So I have a powershell script which uses an app which is configured to be able to obtain list all of the legal hold objects within the environment. Using this same app, I attempt to obtain the Legal hold assignment objects for each of the legal hold objects. However, whenever I construct and perform the API call, every single return for each of the legal hold objects is "404 not found". Below is the powershell code. Not sure what I am doing wrong, as the code takes the legal hold object id directly from the legal hold api call and plugs it into the legal hold assignment api call, so I know that it is not an issue of mis-typing the id. Note the code utilizes the box command line tool to authenticate and obtain the tokens from the app:
Function get-LegalHold { $token = box tokens get $legalurl = 'https://api.box.com/2.0/legal_hold_policies' $headers = @{ } $headers.Add("Authorization", "Bearer $token") Try { $legalOutput = Invoke-RestMethod -Uri $legalurl -Method get -Headers $headers -ErrorAction Stop return $legalOutput } Catch { Write-Host $_.Exception.ToString() $error[0] | Format-List -Force } } $obs = (Get-legalhold).entries $token = box tokens get $headers = @{ } $headers.Add("Authorization", "Bearer $token") Foreach ($ob in $obs) { $legurl = "https://api.box.com/2.0/legal_hold_policies_assignments?policy_id=$($ob.id)" $legurl Try { Invoke-RestMethod -Uri $legurl -Method get -Headers $headers -ErrorAction Stop } Catch { Write-Host $_.Exception.ToString() $error[0] | Format-List -Force } }
サインインしてコメントを残してください。
コメント
2件のコメント