Skip to content

User Create

Mike Garvey edited this page Apr 21, 2022 · 2 revisions

POST /create/user

Creates a new Active Directory user account with the specified attributes from the request body.

Query Parameters

See create query parameters

Body Syntax

Required Body Parameters

Name Type Description
cn string The common name of the newly created group (without the CN= prefix)
sAMAccountName string The NT Account login name - if the string length is more than 20 characters, only the first 20 are used.

Optional Body Parameters

Name Type Default Value Description
password string null The Base64-encoded password to set on the account.
path string null The OU (or container) distinguished name where the user will be created. If this is not specified, the default user location will be used.
userAccountControl string "NormalUser, Disabled, PasswordNotRequired" The UserAccountControl bit flags.
ANY ADDITIONAL ATTRIBUTES depends Any additional attribute/values to have set.

EXAMPLE

{
    "displayName": "whatev",
    "cn": "asdfasdf",
    "path": "OU=Real Users,DC=contoso,DC=com",
    "mail": "whatev@noone.com",
    "mailNickname": "asdfasdf2",
    "manager": "CN=Everyone,OU=Real Users,DC=contoso,DC=com",
    "proxyAddresses": [
        "SMTP:whatev@noone.com",
        "smtp:asdfasdf@gogogogo.net"
    ],
    "userAccountControl": "NormalUser, Disabled, PasswordNeverExpires",
    "userPrincipalName": "whatev@noone.com"
}

Returns

201 Created

{
  "dn": "<DN of the newly created user>",
  "success": true,
  "message": "The user was successfully created."
}

400 BadRequest

The provided query parameters or request body is malformed or invalid.

  • *NOTE* - Depending on where it fails in the process, the user may have been created.
{
  "success": false,
  "message": "An exception occurred.",
  "error": {
    "errorCode": -2147483648,
    "errorExtended": "<additional details if available>",
    "onProperty": "mail",
    "operationType": "Set"
  }
}

Clone this wiki locally