Same as Account in IDHUB

Same as User in Google Workspace.

Attribute Name

Description

Data Type

Required

name.givenName

First name

String

name.familyName

Last name

String

primaryEmail

+ emails.address with primary=”true”

Primary email

String

orgUnitPath

Organizational unit

String

Optional

 emails.address with primary=”false”

Secondary email

String

phones.value

Phone number

String

 password

Password

boolean

changePasswordAtNextLogin

Ask for a password at next sign-in

boolean

API

List

GET https://www.googleapis.com/admin/directory/v1/users/userKey

e.g : GET https://www.googleapis.com/admin/directory/v1/users/liz@example.com

Create

POST https://www.googleapis.com/admin/directory/v1/users

Json Representation
{
  "id": string,
  "primaryEmail": string,
  "password": value,
  "hashFunction": string,
  "isAdmin": boolean,
  "isDelegatedAdmin": boolean,
  "agreedToTerms": boolean,
  "suspended": boolean,
  "changePasswordAtNextLogin": boolean,
  "ipWhitelisted": boolean,
  "name": {
    object ()
  },
  "kind": string,
  "etag": string,
  "emails": value,
  "externalIds": value,
  "relations": value,
  "aliases": [
    string
  ],
  "isMailboxSetup": boolean,
  "customerId": string,
  "addresses": value,
  "organizations": value,
  "lastLoginTime": string,
  "phones": value,
  "suspensionReason": string,
  "thumbnailPhotoUrl": string,
  "languages": value,
  "posixAccounts": value,
  "creationTime": string,
  "nonEditableAliases": [
    string
  ],
  "sshPublicKeys": value,
  "notes": value,
  "websites": value,
  "locations": value,
  "includeInGlobalAddressList": boolean,
  "keywords": value,
  "deletionTime": string,
  "gender": value,
  "thumbnailPhotoEtag": string,
  "ims": value,
  "customSchemas": value,
  "isEnrolledIn2Sv": boolean,
  "isEnforcedIn2Sv": boolean,
  "archived": boolean,
  "orgUnitPath": string,
  "recoveryEmail": string,
  "recoveryPhone": string
}
CODE
Sample Request from google website
{
"primaryEmail": "liz@example.com",
"name": {
 "givenName": "Elizabeth",
 "familyName": "Smith"
},
"suspended": false,
"password": "new user password",
"hashFunction": "SHA-1",
"changePasswordAtNextLogin": false,
"ipWhitelisted": false,
"ims": [
 {
  "type": "work",
  "protocol": "gtalk",
  "im": "liz_im@talk.example.com",
  "primary": true
 }
],
"emails": [
 {
  "address": "liz@example.com",
  "type": "home",
  "customType": "",
  "primary": true
 }
],
"addresses": [
 {
  "type": "work",
  "customType": "",
  "streetAddress": "1600 Amphitheatre Parkway",
  "locality": "Mountain View",
  "region": "CA",
  "postalCode": "94043"
 }
],
"externalIds": [
 {
  "value": "12345",
  "type": "custom",
  "customType": "employee"
 }
],
"relations": [
 {
  "value": "Mom",
  "type": "mother",
  "customType": ""
 },
 {
  "value": "manager",
  "type": "referred_by",
  "customType": ""
 }
],
"organizations": [
 {
  "name": "Google Inc.",
  "title": "SWE",
  "primary": true,
  "type": "work",
  "description": "Software engineer"
 }
],
"phones": [
 {
  "value": "+1 nnn nnn nnnn",
  "type": "work"
 }
],
"orgUnitPath": "/corp/engineering",
"includeInGlobalAddressList": true
}
CODE

 

Update User account

PUT https://www.googleapis.com/admin/directory/v1/users/userKey

 

Delete User account

DELETE https://www.googleapis.com/admin/directory/v1/users/userKey

E.g: DELETE https://www.googleapis.com/admin/directory/v1/users/liz@example.com

 

Undelete User account

(within 5/20 days)

POST https://www.googleapis.com/admin/directory/v1/users/userKey/undelete