Retrieve job information
This command retrieves job information.
API request
Method GET
/users/{account_id}/devices/{connector_id}/jobs
Example
Method GET
https://dk-co.keepit.com/users/5t1sbe-s6zsgx-rtutxq/devices/11ptlk-st7sly-ggba4c/jobs
Response
Code: 200 OK
Response body:
<jobs>
<job>
<guid>76q5c3-qg47t2-53fas1-n5q3gb</guid>
<description>[backup][bl][auto][gsuite]{Google Workspace Backup}</description>
<execsummary><?xml version="1.0" encoding="utf-8"?><execsummary><summary>Done</summary><exitreason>done</exitreason></execsummary><!-- End of Document 2024-11-27T21:56:09Z --></execsummary>
<type>backup</type>
<priority>0</priority>
<active>false</active>
<start>2024-11-27T21:55:21Z</start>
<scheduled>2024-11-27T09:55:57Z</scheduled>
<dispatched>2024-11-27T21:55:23Z</dispatched>
<started>2024-11-27T21:55:23Z</started>
<succeeded>2024-11-27T21:56:10Z</succeeded>
<progress>1.0</progress>
</job>PowerShell script
try {
$username = '<API Token username>'
$password = '<API Token password>'
$userId = '<Account GUID>'
$connectorId = '<Connector GUID>'
$hostname = 'dk-co.keepit.com'
$basicauth = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}"))
$headers = @{
"User-Agent" = "PowerShell-Keepit-API-Agent-1.0"
"Authorization" = "Basic $basicauth"
}
$response = Invoke-WebRequest -UseBasicParsing `
-Uri "https://${hostname}/users/${userId}/devices/${connectorId}/jobs" `
-Method Get -Headers $headers -ErrorAction Stop -TimeoutSec 10
$xmlContent = [xml]$response.Content
$xmlContent.SelectNodes("//job") | ForEach-Object {
$guid = $_.guid
$type = $_.type
$active = $_.active
$started = if ($_.started) { $_.started } else { "Scheduled" }
$succeeded = $_.succeeded
$failed = $_.failed
$progress = $_.progress
$status = if ($succeeded) {
"Succeeded at $succeeded"
} elseif ($failed) {
"Failed at $failed"
}
Write-Host "Job GUID: $guid"
Write-Host "Type: $type"
Write-Host "Active: $active"
Write-Host "Started: $started"
Write-Host "Status: $status"
Write-Host "Progress: $progress"
Write-Host "---------------------------"
}
}
catch {
$line = $_.InvocationInfo.ScriptLineNumber
Write-Host "Cannot query Keepit API due to: $_"
Write-Host "at line $line"
}Script result
Job GUID: 76q5c3-qg47t2-53fas1-n5q3gb Type: backup Active: false Started: 2024-11-27T21:55:21Z Status: Succeeded at 2024-11-27T21:56:10Z Progress: 1.0 --------------------------- Job GUID: s0qn1k-1azqjb-46g362-rg5n4r Type: srestore Active: false Started: 2024-11-28T08:21:20Z Status: Succeeded at 2024-11-28T09:23:27Z Progress: 1.0 --------------------------- Job GUID: p6eqb9-4t1wwi-2vnnuw-y1oh5c Type: backup Active: true Started: Scheduled Status: Progress: ---------------------------