I have checked How to delete multiple test cases in Azure DevOps
It not works for me.
Using PowerShell scripts alone, I want to delete multiple test cases in one go in Azure DevOps. Currently, portal only allows to delete one at a time.
I have tried like below way, and throws exceptions.
$url = "https://dev.azure.com/testarulmouzhie/testDemo_Project/_apis/test/testcases/21?api-version=5.0-preview.1"
Invoke-RestMethod -Uri $url -Method Delete -ContentType application/json
it throws error like below one-
Even tried with the new api version, same error comes-
$url = "https://dev.azure.com/testarulmouzhie/testDemo_Project/_apis/test/testcases/21?api-version=5.1-preview.1"
Invoke-RestMethod -Uri $url -Method Delete -ContentType application/json
Attached the error for ref-
Invoke-RestMethod :
Azure DevOps
Service Status Support @AzureDevOps
At line:1 char:1
+ Invoke-RestMethod -Uri $url -Method Delete -ContentType application/json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Can anyone help to solve this? Thanks in advance.
For ref, anyway simple GET rest api calls works fine. i have tried below one and those are working fine.
$AzureDevOpsPAT = "a2wzly2bsirXXXXXXXXXXXXXXXXXXXXXXXXXXX"
$OrganizationName = "testarulmouzhie"
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($AzureDevOpsPAT)")) }
$UriOrga = "https://dev.azure.com/$($OrganizationName)/"
$uriAccount = $UriOrga + "_apis/projects?api-version=5.1"
Invoke-RestMethod -Uri $uriAccount -Method get -Headers $AzureDevOpsAuthenicationHeader
Even used fiddler and tried to capture error logs- attached those too