Delete Issue
  • 21 Feb 2024
  • 1 Minute to read
  • Dark
    Light
  • PDF

Delete Issue

  • Dark
    Light
  • PDF

Article Summary

The Delete Issue is an endpoint in ProGet's SCA Directory API that will delete an Issue.

šŸš€ Quick Example: Deleting an Issue with Curl

This example deletes issue 4 in version 1.2.3 of a project myProject, authenticating with the API key abc12345:

curl -X DELETE -H "X-ApiKey: abc12345" "https://proget.corp.local/api/sca/issues?project=myProject&version=1.2.3&number=4"

Request Specification

To delete an issue, simply DELETE to the URL with an appropriate API Key.

DELETE /api/sca/issues?project=Ā«projectNameĀ»&version=Ā«releaseVersionĀ»&number=Ā«issueNumberĀ»

Deleting an issue requires the project name (e.g. myProject), version (e.g. 1.2.3), and issue number (e.g. 4) :

DELETE /api/sca/issues?project=myProject&version=1.2.3&number=4

Response Specification

ResponseDetails
200 (Success)indicates issue was deleted
400 (Invalid Input)indicates invalid or missing arguments; the body will provide some details as text
403 (Unauthorized API Key)indicates a missing, unknown, or unauthorized API Key; the body will be empty
500 (Server Error)indicates an unexpected error; the body will contain the message and stack trace, and this will also be logged

Sample Usage Scripts

Delete all issues (Powershell)

This script deletes all issues (resolved and unresolved) of version 1.2.3 of project myProject:

$apiUrl = "https://proget.corp.local"
$apiKey = "a1b2c3d4e5"
$projectName = "Project"
$releaseVersion = "1.2.3"

$listApiUrl = "$apiUrl/api/sca/issues?project=$projectName&version=$releaseVersion"
$deleteApiUrl = "$apiUrl/api/sca/issues?project=$projectName&version=$releaseVersion&number="

$headers = @{
    "X-ApiKey" = $apiKey
}

function ListIssues {
    $response = Invoke-RestMethod -Uri $listApiUrl -Headers $headers -Method Get
    return $response
}

function DeleteIssue {
    param (
        [int]$issueNumber
    )
    $deleteUrl = $deleteApiUrl + $issueNumber
    Invoke-RestMethod -Uri $deleteUrl -Headers $headers -Method Delete
}

try {
    $issues = ListIssues

    foreach ($issue in $issues) {
        Write-Output "Deleting issue $($issue.number)..."
        DeleteIssue -issueNumber $issue.number
    }
    
    Write-Output "All issues deleted successfully."
}
catch {
    Write-Error "An error occurred: $_"
}

Was this article helpful?

What's Next