This is real, irreversible deletion. Every job currently in the trash -- and its entire run history -- is permanently destroyed. Delete a Job and Restore a Job never do this on their own; this is the one call that actually purges the trash. Make sure that's really what you want before calling it -- there's no confirmation step at the API level, and nothing this call does can be undone.
Having trouble reaching the API, or logging in from another machine? See Network Access & Authentication Security -- by default the Api only answers
localhost, and PowerShell needs an extra flag once it does answer elsewhere.
Order of Operations
- Authenticate to the API.
- Request the purge.
The call
DELETE /api/jobs/trash
No route parameters, no query parameters, no request body.
Permission needed: Job.Edit.
C# example
var jsonOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web);
// Step 1: Authenticate to the API.
using var handler = new HttpClientHandler { UseDefaultCredentials = true };
using var client = new HttpClient(handler) { BaseAddress = new Uri("http://your-minion-agent-server:5443") };
client.DefaultRequestHeaders.Add("X-App-Name", "MyIntegration");
// Step 2: Request the purge. Irreversible -- make sure this is really what you want.
var response = await client.DeleteAsync("/api/jobs/trash");
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadFromJsonAsync<EmptyTrashResult>(jsonOptions);
Console.WriteLine($"Permanently deleted {result!.PurgedCount} job(s).");
record EmptyTrashResult(int PurgedCount);
Not on a domain machine? Swap in the app-account login from Calling the API From Your Own Code.
PowerShell example
# Step 1: Authenticate to the API.
$headers = @{ "X-App-Name" = "MyIntegration" }
# Step 2: Request the purge. Irreversible -- make sure this is really what you want. (-AllowUnencryptedAuthentication: PowerShell requires this for Windows auth over plain http to anything but localhost -- see "Network Access & Authentication Security".)
$result = Invoke-RestMethod -Uri "http://your-minion-agent-server:5443/api/jobs/trash" `
-Method Delete -UseDefaultCredentials -AllowUnencryptedAuthentication -Headers $headers
"Permanently deleted $($result.purgedCount) job(s)."
What you get back
200 OK:
{ "PurgedCount": 3 }
Codes this call can return
See API Response Codes for what each one means in general. For this specific call:
- 200 -- purged (
PurgedCountmay be0if the trash was already empty). - 403 -- you don't have
Job.Edit.
See also: List Deleted Jobs, Delete a Job, Restore a Job.