Element

Type

Requirement

Description

Additional Note

enabled

boolean

Optional

Indicates whether the user account is enabled or disabled. 

"true" to enable, "false" to disable the account.

subscribed

boolean

Optional

Marks if the user is subscribed to Keepit services.

 

product

string

Optional

ID of the product assigned to the account.

Empty value removes the product assignment from the account.

external_id

String

Optional

External system ID.

Utility field for use by external provisioning systems.

grace-expires

ISO 8601 datetime or empty

Optional

Date and time when the user's grace period expires.

If grace-expires element is empty, grace time will be unset for this account.
Format: `YYYY-MM-DDTHH:MM:SSZ` (ISO 8601).

parent

string

Optional

GUID of the new parent account.

Used to move the indicated account under another parent account.

Update account settings

Example

Method PUT

https://dk-co.keepit.com/users/psmqd-3nqijs-9qi26x/

Body

<user_update>
     <product>a9y02y-qngj1m-yvh5r8</product>
</user_update>

Response

Code: 200 OK

Response body:

Account updated successfully

PowerShell script

try {
    $username = '<Token username>'
    $password = '<Token password>'

    $subaccountID = '<Subaccount GUID>'
    $productID = '<Product ID>'

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

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

    $xmlBody = @"
<user_update>
    <product>$productID</product>
</user_update>
"@

    $response = Invoke-WebRequest -Uri $url -Method Put -Headers $headers -Body $xmlBody -ErrorAction Stop -TimeoutSec 10

    Write-Host $response.Content
}
catch {
    $line = $_.InvocationInfo.ScriptLineNumber
    Write-Host "Cannot query Keepit API due to: $_"
    Write-Host "at line $line"
}

Additional information

  • This allows an account to be enabled or disabled, and it allows the product to be changed and the external_id to be changed. To clear the product, supply an empty string for the product.
  • When an account is disabled, authentication for that account will fail.
  • If the parent element is set, this will move the account to the new parent GUID. Only an administrator or partner token can move an account, and the parent can only be set to an account at or beneath the authenticated account.