Retrieve reason for unhealthy or critical status

This command retrieves the reason for an unhealthy or critical status.

API request 

Method GET 

 /users/{account_id}/devices/{connector_id}/health?reason=true

Example

Method GET

https://dk-co.keepit.com/users/5t1sbe-s6zsgx-rtutxq/devices/11ptlk-st7sly-ggba4c/health?reason=true

Response

Code: 200 OK

Response body:

<devhealth>
    <health>critical</health>
    <reason>BADLOGIN</reason>
</devhealth>

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}/health?reason=true" `
      -Method Get -Headers $headers -ErrorAction Stop -TimeoutSec 10

    $xmlContent = [xml]$response.Content

    $healthStatus = $xmlContent.SelectSingleNode("//health").InnerText
    $reason = $xmlContent.SelectSingleNode("//reason").InnerText
    Write-Host "Health Status: $healthStatus"
    Write-Host "Reason: $reason"
}
catch {
    $line = $_.InvocationInfo.ScriptLineNumber
    Write-Host "Cannot query Keepit API due to: $_"
    Write-Host "at line $line"
}

Script result

Health Status: critical
Reason: BADLOGIN

Additional information

Possible health reasons:

Reason

Explanation

OK

Connector is healthy

GENERIC

Problem with account

NOCHECKIN

Connector did not check in as expected

CLOUDNOCHECKIN

Cloud connector did not check in as expected

BADLOGIN

Failed to login

NONADMINLOGIN

Invalid credentials

BADTOKEN

Login either expired or was revoked

QUOTAVIOLATED

One or more product resource limits have been exceeded

GRACETIMERSTARTED

Grace period has begun

GRACETIMEREXPIRED

Grace period has expired

INCOMPLETECONFIG_AZURE_AD

Entra ID groups and/or administrative units missing from backup configuration

INCOMPLETECONFIG_AZURE_DO

Azure DevOps organizations missing from backup configuration

INCOMPLETECONFIG_GSUITE

Google Workspace groups and/or organizational units missing from backup configuration

BLOCKEDBYEXTERNALQUOTA

Daily API calls limit exceeded

MISSING_TEAMS_CHAT_APP_REGISTRATION

Missing Teams chat app registration

MISSING_PLANS_PRESENT

Tenant missing Microsoft licenses

SMALLFILESBACKUP

Processing a large number of small files

THROTTLINGBACKUP

Connector is being throttled by Microsoft

INITIAL_CONFIGURATION_PENDING

Connector is created, but not configured