Retrieve account settings

This command retrieves account settings. It can be executed either directly at the account level or from the parent account.

API request 

Method GET 

/users/{account_id}

Example

Method GET 

https://dk-co.keepit.com/users/nq2v51-5mx23m-qb7sah/

Response

Code: 200 OK

Response body:

<user>
    <enabled>true</enabled>
    <created>2024-11-21T11:03:16Z</created>
    <product>a9y02y-qngj1m-yvh5r8</product>
    <parent>716vh1-7r91yq-bxsob1</parent>
    <subscribed>true</subscribed>
</user>

PowerShell script

try {
    $username = '<Token username>'
    $password = '<Token password>'
    $userID = '<Account GUID>'

    $basicauth = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}"))
    $headers = @{
        "User-Agent" = "PowerShell-Keepit-API-Agent-1.0"
        "Authorization" = "Basic $basicauth"
    }

    $url = "https://dk-co.keepit.com/users/$userID/"

    $response = Invoke-WebRequest -Uri $url -Method Get -Headers $headers -ErrorAction Stop -TimeoutSec 10

    [xml]$xmlContent = $response.Content

    foreach ($node in $xmlContent.user.ChildNodes) {
        Write-Host "$($node.Name): $($node.InnerText)"
    }
}
catch {
    $line = $_.InvocationInfo.ScriptLineNumber
    Write-Host "Cannot query Keepit API due to: $_"
    Write-Host "at line $line"
}

Additional information

You can select the desired response schema by setting the "Accept" header. Custom media types in the API allow consumers to specify the format of the data they wish to receive.

Header:

Accept: application/vnd.keepit.v{0|1}

If the "Accept" header does not include a version number, the response will default to schema v0.

Note: The <product> element reports the product directly assigned to the account. If no product is set on the account, it inherits the product from its parent account (and so on recursively). This API endpoint provides the product directly assigned to the account, not the inherited product. To determine the active product on the account, you must trace back to the parent accounts until a product is found.