Skip to main content

"cloneAccount"

JSON ADMIN "cloneAccount" action clones an existing account and its roles

The "cloneAccount" action clones an existing account along with its login properties and roles. It assigns a new name and a new password to the new account and optionally assigns new metadata.

Request examples

{
  "api": "admin",
  "action": "cloneAccount",
  "params": {
    "sourceUsername": "NewAccount1",
    "cloneUsername": "NewAccount3"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "api": "admin",
  "action": "cloneAccount",
  "params": {
    "sourceUsername": "NewAccount2",
    "cloneUsername": "NewAccount4",
    "clonePassword": "CorrectHorseBatteryStaple",
    "cloneRoles": true,
    "cloneDescription": "This account was cloned from NewAccount2.",
    "cloneMetadata": {}
  },
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "requestId": "1"
}

Use the cloneAccount API action to clone an existing account along with its login properties and roles

cloneAccountcloneAccountsclone accountAPI actionJSON ADMIN APIjsonAction
Table 1. account property summaries

Property

Description

Default

Type

Limits (inclusive)

sourceUsername

specifies the source account to be cloned

Required - No default value

string

1 to 31 bytes

cloneUsername

specifies the new name of the clone account

Required - No default value

string

1 to 31 bytes

clonePassword

specifies the code used to authenticate the clone account

Required - No default value

string

1 to 63 bytes

cloneRoles

specifies whether the cloned account will also have the roles assigned to the source account

true

Boolean

true
false

cloneDescription

describes the clone account

""

string

cloneMetadata

contains user-defined properties that add keywords and tags about the clone account

{}

object



The "sourceUsername" property is a required string up to 31 bytes long that specifies the source account to be cloned.

The "cloneUsername" property is a required string up to 31 bytes long that specifies the new of name of the clone account.

The "clonePassword" property is a required string up to 63 bytes long that specifies the code used to authenticate the clone account.

  • If it is set to an empty string, the server authenticates the account without a password. This is not recommended because it allows anyone to log into the account without supplying a password.

The "cloneRoles" property is an optional Boolean that specifies whether the cloned account will also have the roles assigned to the source account.

  • If omitted, the clone will not have the same assigned roles as the source account.

The "cloneDescription" property is an optional string up to 31 bytes long that specifies the "accountDescription" for the clone account.

  • If omitted or set to null, an account description is not set.

  • If present and set to a non-empty string, it is set to the new description.

  • If present and set to an empty string, it is set to the empty string.

The "cloneMetadata" property contains user-defined properties that add keywords and tags about the clone account. The server indexes this field with a full-text index so you can search for any word or phrase to find the account.

  • In the clone account, the value in this property will become the value for the "metadata" property.