System User
This subcategory has APIs for configuring details regarding the system user logged in to AhsayCBS. This includes other functions such as adding new users, removing them, and authorizing which users have admin rights or not. Additionally, already existing users can be listed for the API user’s benefit.
AddSysUser
This API can be used to add a system user(s).
The settings can be found on the AhsayCBS web console at:
- System Settings > Basic > Administrative Access
Starting with AhsayCBS v8.3.4.0 affecting all APIs, if AhsayCBS Administrative Access feature is enabled, users may see the error message:
“Your password has expired and must be changed. Please update in web console or by UpdateSysUser API”
This message may appear if a system user’s password is expired when calling any API except UpdateSysUser.do. AddSysUser.do and UpdateSysUser.do may see error messages regarding password complexity when complexity settings are enabled.
The settings can be found on the AhsayCBS web console at: System Settings > Basic > Administrative Access > Authentication > Password.
URL
https://CBS.EXAMPLE.COM/obs/api/json/AddSysUser.do
Available Since Version: 9.1
Parameters
Key | Type | Description |
---|---|---|
SysUser | String | Username of an AhsayCBS System User with Admin, API or Read-Only API role. |
SysPwd | String | Password matching SysUser. |
LoginName | String | Login name of the system user. |
Password | String | Password in plaintext or hashed password. If passing hashed, include PasswordHashed key. Use ListSystemUsers.do to lookup HashedPwd. |
PasswordHashed | Boolean | An indicator for account’s input password if hashed or not. Default “false” if NOT in request. If PasswordHashed is set to false, the Password will be hashed and stored. If set as true, Password will be stores as-is. If PasswordHashed is set to true and not using a hashed password, then users will not be able to login to the system. Hash Algorithm: Plaintext input > encode Hash algorithm SHA-256 > output Hex bytes > encode Hex-Base64 > Hashed text output |
Role | String | Role of the system account. The value can be set to one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY. |
Hostname | String | Required if "Role" is set to RESELLER. |
IP | String | Required if "Role" is set to RESELLER. The IP address must include the HTTPS connector port, for example: 0.0.0.0:443 |
IsShowRebrandingPages | Boolean | Corresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER. |
IsSendConsolidatedReport | Boolean | Corresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER. |
IsFreeTrialOfferAllowed | Boolean | True = Allow sub-admin accounts to configure Free Trial options and allow to set users to Trial user type. Corresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER. |
Return Values
Key | Type | Description |
---|---|---|
Status | String | "OK" or "Error" |
Message | String | Error message, it only appears if status displays "Error". |
ExptType | String | The type of exception, will only be displayed if the status is "Error". |
Examples
Example 1
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"LoginName":"api_user",
"Password":"qWeRtY123456!@#$%",
"PasswordHashed":"false",
"Role":"API_ONLY"
}
OUTPUT 1
{
"Status":"OK"
}
OUTPUT 2 - If another user with the same user name already exists
{
"Status":"Error",
"Message":"Name is already used. Please use another name.",
"ExptType":"java.lang.Exception"
}
Example 2: INPUT IsSendConsolidatedReport for Role = ADMIN
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"LoginName":"AdminTom",
"Password":"qWeRtY123456!@#$%",
"Role":"ADMN",
"IsSendConsolidatedReport":"true"
}
OUTPUT
{
"Status":"Error",
"Message":"Update consolidated report setting for ‘Admin’ system user through ‘UpdateServerConfig.do’",
"ExptType":"java.lang.Exception"
}
Example 3: INPUT IsShowRebrandingPages for Role = ADMIN
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"LoginName":"AdminTom",
"Password":"qWeRtY123456!@#$%",
"Role":"ADMN",
"IsShowRebrandingPages":"false"
}
OUTPUT
{
"Status":"Error",
"Message":"Invalid parameter IsShowRebrandingPages for ADMIN system user",
"ExptType":"java.lang.Exception"
}
UpdateSysUser
This API can be used to update the password and status of a system user.
The settings can be found on the AhsayCBS web console at:
- System Settings > Basic > Administrative Access
Starting with AhsayCBS v8.3.4.0 affecting all APIs, if AhsayCBS Administrative Access feature is enabled, users may see the error message:
“Your password has expired and must be changed. Please update in web console or by UpdateSysUser API”
This message may appear if a system user’s password is expired when calling any API except UpdateSysUser.do. AddSysUser.do and UpdateSysUser.do may see error messages regarding password complexity when complexity settings are enabled.
The settings can be found on the AhsayCBS web console at: System Settings > Basic > Administrative Access > Authentication > Password.
URL
https://CBS.EXAMPLE.COM/obs/api/json/UpdateSysUser.do
Available Since Version: 9.1
Parameters
Key | Type | Description |
---|---|---|
SysUser | String | Username of an AhsayCBS System User with Admin, API or Read-Only API role. |
SysPwd | String | Password matching SysUser. |
LoginName | String | Login name of the system user. |
Password | String | Password in plaintext or hashed password. If passing hashed, include PasswordHashed key. Use ListSystemUsers.do to lookup HashedPwd. |
Status | String | Can either be "SUSPENDED" or "ENABLED". |
PasswordHashed | Boolean | An indicator for account’s input password if hashed or not. Default “false” if NOT in request. If PasswordHashed is set to false, the Password will be hashed and stored. If set as true, Password will be stores as-is. If PasswordHashed is set to true and not using a hashed password, then users will not be able to login to the system. Hash Algorithm: Plaintext input > encode Hash algorithm SHA-256 > output Hex bytes > encode Hex-Base64 > Hashed text output |
Role | String | Role of the system account. The value can be set to one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY. |
IsShowRebrandingPages | Boolean | Corresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER. |
IsSendConsolidatedReport | Boolean | Corresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER. |
IsFreeTrialOfferAllowed | Boolean | True = Allow sub-admin accounts to configure Free Trial options and allow to set users to Trial user type. Corresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER. |
Return Values
Key | Type | Description |
---|---|---|
Status | String | "OK" or "Error" |
Message | String | Error message, it only appears if status displays "Error". |
ExptType | String | The type of exception, will only be displayed if the status is "Error". |
Examples
Example 1
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"LoginName":"admin123",
"Password":"changepassword",
"PasswordHashed":"false"
}
OUTPUT
{
"Status":"OK"
}
Example 2: Missing the LoginName parameter
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"Password":"changepassword"
}
OUTPUT
{
"Status":"Error",
"Message":"[Error] Parameter LoginName is null/empty!",
"ExptType":"com.ahsay.obs.core.dbs.DbsException"
}
Example 3
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"LoginName":"admin123",
"Password":"changepassword",
"Status":"ENABLED"
}
OUTPUT
{
"Status":"OK"
}
Example 4
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"LoginName":"admin123",
"Password":"changepassword",
"Status":"LOCKED"
}
OUTPUT
{
"Status":"Error",
"Message":"Invalid value. ‘Status’ must be ‘ENABLED’ or ‘SUSPENDED’",
"ExptType":"com.ahsay.obs.core.dbs.DbsException"
}
Example 5
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"LoginName":"admin123",
"Password":"changepassword",
"Status":0
}
OUTPUT
{
"Status":"Error",
"Message":"JSONObject\”Status\”\not a string",
"ExptType":"org.json.JONException"
}
Example 6
INPUT
{
"SysUser":"sample",
"SysPwd":"sample"
}
OUTPUT
{
"Status":"Error",
"Message":"[Error] Parameter LoginName is null/empty!",
"ExptType":"com.ahsay.obs.core.dbs.DbsException"
}
RemoveSysUser
This API can be used to remove a system user.
The settings can be found on the AhsayCBS web console at:
- System Settings > Basic > Administrative Access
URL
https://CBS.EXAMPLE.COM/obs/api/json/RemoveSysUser.do
Available Since Version: 9.1
Parameters
Key | Type | Description |
---|---|---|
SysUser | String | Username of an AhsayCBS System User with Admin, API or Read-Only API role. |
SysPwd | String | Password matching SysUser. |
RemoveLoginName | String | Login name of the system user to be removed. |
Return Values
Key | Type | Description |
---|---|---|
Status | String | "OK" or "Error" |
Message | String | Error message, it only appears if status displays "Error". |
ExptType | String | The type of exception, will only be displayed if the status is "Error". |
Examples
Example 1
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"RemoveLoginName":"dummyAdmin"
}
OUTPUT
{
"Status":"OK"
}
Example 2: If the system user does not exist
INPUT
{
"SysUser":"sample",
"SysPwd":"sample",
"RemoveLoginName":"nosuchuser"
}
OUTPUT
{
"Status":"Error",
"Message":"System user ‘nosuchuser’ does not exist",
"ExptType":"org.json.JSONException"
}
AuthSystemUser
The settings can be found on the AhsayCBS web console at:
- System Settings > Basic > Administrative Access
URL
https://CBS.EXAMPLE.COM/obs/api/json/AuthSystemUser.do
Available Since Version: 9.1
Parameters
Key | Type | Description |
---|---|---|
SysUser | String | Username of an AhsayCBS System User with Admin or API role. |
SysPwd | String | Password matching SysUser. |
Return Values
Key | Type | Description |
---|---|---|
Status | String | "OK" or "Error" |
Message | String | Error message, it only appears if status displays "Error". |
ExptType | String | The type of exception, will only be displayed if the status is "Error". |
Examples
Example 1: For SysUser with Admin role
INPUT
{
"SysUser":"Admin",
"SysPwd":"password"
}
OUTPUT
{
"Status":"OK"
}
Example 2: For SysUser with Read-Only Admin role
INPUT
{
"SysUser":"Read-Only Admin",
"SysPwd":"sample"
}
OUTPUT
{
"Status":"Error",
"Message":"Incorrect system username/password",
"ExptType":"com.ahsay.obs.core.dbs.c"
}
ListSystemUsers
This API lists the information of all system users.
The settings can be found on the AhsayCBS web console at:
- System Settings > Basic > Administrative Access
URL
https://CBS.EXAMPLE.COM/obs/api/json/ListSystemUsers.do
Available Since Version: 9.1
Parameters
Key | Type | Description |
---|---|---|
SysUser | String | Username of an AhsayCBS System User with Admin, API or Read-Only API role. |
SysPwd | String | Password matching SysUser. |
RoleOnly | Boolean | List the role of system users only (SystemUserRole). |
Host | String | AhsayCBS’s URL. It is required for calling API from Redirector only. |
Return Values
Key | Type | Description |
---|---|---|
Status | String | "OK" or "Error" |
Data | Array of SystemUserRole or Array of SystemUser | If RoleOnly is true, an array of SystemUserRole is returned. Otherwise, an array of SystemUser is returned. |
Message | String | Error message, it only appears if status displays "Error". |
ExptType | String | The type of exception, will only be displayed if the status is "Error". |
JSON Objects
SystemUserRole
Key | Type | Description |
---|---|---|
Name | String | Name of user role. |
Role | String | The value can be any one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY. |
SystemUser
Key | Type | Description |
---|---|---|
Name | String | Name of user. |
Role | String | The value can be any one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY. |
Status | String | Can either be "SUSPENDED" or "ENABLED". |
HashedPwd | String | Encrypted (Hashed) password of the user. |
IsShowRebrandingPages | Boolean | True=Show Branding UI. |
IsSendConsolidatedReport | Boolean | True=Send Consolidated Reports. |
IsFreeTrialOfferAllowed | Boolean | True=Free Trial option is allowed. False=Free Trial option hidden, users cannot be set to Trial user type. |
Example
INPUT
{
"SysUser":"api_user",
"SysPwd":"qWeRtY123456!@#$%"
}
OUTPUT
{
"Status":"OK",
"Data":[
{
"Role":"ADMIN",
"Status":"ENABLED",
"HashedPwd":"ggeRi1mrAu37jPPCb6q6sRyBRlz/VxUgHbso6jqZu0I=",
"IsShowRebrandingPages":false,
"Name":"system",
"IsFreeTrialOfferAllowed":true
}
]
}