Endpoint: /sites/{siteid}/users/{userid}
Returns, updates, and deletes user account details.
-
GET
-
PATCH
-
DELETE
-
POST
Method & URL
GET https://[server URL]:[port]/admin/v2/sites/{siteId}/users/{userid}
GET Body Sample
### GET SITE SPECIFIC USER ###
# @name usersList
GET https://{{host}}/admin/v2/sites/{{Siteid}}/users HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
###
@Usersid = {{usersList.response.body.$.data[0].id}}
###
GET https://{{host}}/admin/v2/sites/{{Siteid}}/users/{{Usersid}} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
###
GET Response Body Sample
{ "data": { "attributes": { "accountEnabled": "inherit", "agreementToTermsOfService": "unknown", "as2": {
"inbound": { "enabled": "inherit" }, "outbound": { "enabled": "inherit" } }, "changePassword": {
"enabled": "inherit", "value": { "changeAdminProvidedPasswordUponFirstUse": "inherit",
"mustChangePassword": false, "passwordExpiration": { "enabled": true, "value": { "maxAgeDays": 90,
"emailUpon": true, "remindPrior": { "enabled": false, "value": { "daysBefore": 5, "emailUser": true
GET PowerShell Sample
# get a specific users information
Write-Output "Users"
Write-Output "-----"
$userList = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/users"
-Method 'GET' -Headers $authHeader
Write-Output $userList | ConvertTo-Json
foreach ($user in $userList.data)
{
Write-Output ("User $($user.id): $($user.attributes.loginName)")
}
$userid = $userList.data[0].id
# get user’s data
Write-Output "Users"
Write-Output "-----"
$userList = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/users/$userid"
-Method 'GET' -Headers $authHeader
Write-Output $userList | ConvertTo-Json
foreach ($user in $userList.data)
{
Write-Output ("User $($user.id): $($user.attributes.loginName)")
}
PATCH https://[server URL]:[port]/admin/v2/sites/{siteId}/users/{userid}/
PATCH Body Sample
@Usersid = {{usersList.response.body.$.data[0].id}}
###
### UPDATE A USERS PERSONAL INFORMATION ###
PATCH https://{{host}}/admin/v2/sites/{{Siteid}}/users/{{Usersid}}/ HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
{
"data": {
"type": "user",
"attributes": {
"personal": {
"name": "MR JONES",
"description": “MANAGER",
"email": "user@example.com",
"duns": "",
"phone": "",
"mobile": "2107221301",
"pager": "",
"fax": "",
"company": "",
"partnerId": "",
"custom1": "1234",
"custom2": "5678",
"custom3": "abcd",
"comments": "Does this work?"
},
"isEuDataSubject": "yes",
"consentToPrivacyPolicy": "grantedExplicit",
"agreementToTermsOfService": "agreedExplicit"
}
}
}
PATCH Response Body Sample
{ "data": { "attributes": { "accountEnabled": "inherit", "agreementToTermsOfService": "agreedExplicit",
"as2": { "inbound": { "enabled": "inherit" }, "outbound": { "enabled": "inherit" } }, "changePassword": {
"enabled": "inherit", "value": { "changeAdminProvidedPasswordUponFirstUse": "inherit",
"mustChangePassword": false, "passwordExpiration": { "enabled": true, "value": { "maxAgeDays": 90,
"emailUpon": true, "remindPrior": { "enabled": false, "value": { "daysBefore": 5, "emailUser": true } } } } } },
"connectionTimeout": { "enabled": "inherit", "value": { "maxSec": 0 }
PATCH PowerShell Sample
##UPDATE USERS
Write-Output "Update user data"
Write-Output "-----"
$update =
'{
"data": {
"type": "user",
"attributes": {
"accountEnabled": "no"
}
}
}'
$update = $update | ConvertFrom-Json
$update = $update | ConvertTo-Json -Depth 10
$PatchReturn = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/users/$userid"
-Method 'PATCH' -Headers $authHeader -Body $update
DELETE https://[server URL]:[port]/admin/v2/sites/{siteId}/users/{userid}/
DELETE Body Sample
### REMOVE THE USER ### (userOnly, userAndHomeFolder)
DELETE https://{{host}}/admin/v2/sites/{{Siteid}}/users/{{Usersid}} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
{
"parameters": {
"scope": "userAndHomeFolder"
}
}
###
DELETE Response Body Sample
HTTP/1.1 204 No Content Date: Fri, 04 Feb 2022 21:00:36 GMT Content-Length: 0
Cache-Control: no-cache, no-store, must-revalidate Expires: -1
X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' data:;
Referrer-Policy: no-referrer
DELETE PowerShell Sample
$update =
'{
"parameters": {
"scope": "userAndHomeFolder"
}
}'
$update = $update | ConvertFrom-Json
$update = $update | ConvertTo-Json -Depth 10
# delete
Write-Output "Delete User"
Write-Output "-----"
$deleteList = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/users/$userid"
-Method 'DELETE' -Headers $authHeader -Body $update
Write-Output $deleteList | ConvertTo-Json
foreach ($user in $deletList.data)
{
Write-Output ("User $($user.id): $($user.attributes.loginName)")
}