SingleScripts/Delete-Folder.ps1
[CmdletBinding()] Param( [Parameter(Mandatory=$true,Position=1)] [string] $DBAPIRootUrl, [Parameter(Mandatory=$True,Position=2)] [string] $DBAPIKey, [Parameter(Mandatory=$True,Position=3)] [string] $FolderPath, [Parameter(Mandatory=$False,Position=4)] [switch] $Recursive, [Parameter(Mandatory=$False,Position=5)] [switch] $Force ) $DBAPIUrl = $DBAPIRootUrl.Trim('/') + "/api/2.0/workspace/delete" $headers = @{ Authorization = "Bearer $DBAPIKey" "Content-Type" = "application/json" } $bodyJson = @{ path = $FolderPath recursive = $Recursive.IsPresent } | ConvertTo-Json Write-Information "Deleting Folder $FolderPath ... " try { $result = Invoke-RestMethod -Uri $DBAPIUrl -Method POST -Headers $headers -Body $bodyJson } catch { if(-not $Force.IsPresent) { throw } } $result |