Skip to main content

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

KeyTypeDescription
SysUserStringUsername of an AhsayCBS System User with Admin, API or Read-Only API role.
SysPwdStringPassword matching SysUser.
LoginNameStringLogin name of the system user.
PasswordStringPassword in plaintext or hashed password. If passing hashed, include PasswordHashed key. Use ListSystemUsers.do to lookup HashedPwd.
PasswordHashedBoolean

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

RoleStringRole of the system account. The value can be set to one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY.
HostnameStringRequired if "Role" is set to RESELLER.
IPString

Required if "Role" is set to RESELLER.

The IP address must include the HTTPS connector port, for example: 0.0.0.0:443
IsShowRebrandingPagesBooleanCorresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER.
IsSendConsolidatedReportBooleanCorresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER.
IsFreeTrialOfferAllowedBooleanTrue = 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
KeyTypeDescription
StatusString"OK" or "Error"
MessageStringError message, it only appears if status displays "Error".
ExptTypeStringThe 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

KeyTypeDescription
SysUserStringUsername of an AhsayCBS System User with Admin, API or Read-Only API role.
SysPwdStringPassword matching SysUser.
LoginNameStringLogin name of the system user.
PasswordStringPassword in plaintext or hashed password. If passing hashed, include PasswordHashed key. Use ListSystemUsers.do to lookup HashedPwd.
StatusStringCan either be "SUSPENDED" or "ENABLED".
PasswordHashedBoolean

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

RoleStringRole of the system account. The value can be set to one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY.
IsShowRebrandingPagesBooleanCorresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER.
IsSendConsolidatedReportBooleanCorresponding to the three checkboxes on AhsayCBS UI when edit a sub-admin applies only if “Role” is set to RESELLER.
IsFreeTrialOfferAllowedBooleanTrue = 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
KeyTypeDescription
StatusString"OK" or "Error"
MessageStringError message, it only appears if status displays "Error".
ExptTypeStringThe 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

KeyTypeDescription
SysUserStringUsername of an AhsayCBS System User with Admin, API or Read-Only API role.
SysPwdStringPassword matching SysUser.
RemoveLoginNameStringLogin name of the system user to be removed.
Return Values
KeyTypeDescription
StatusString"OK" or "Error"
MessageStringError message, it only appears if status displays "Error".
ExptTypeStringThe 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

KeyTypeDescription
SysUserStringUsername of an AhsayCBS System User with Admin or API role.
SysPwdStringPassword matching SysUser.
Return Values
KeyTypeDescription
StatusString"OK" or "Error"
MessageStringError message, it only appears if status displays "Error".
ExptTypeStringThe 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

KeyTypeDescription
SysUserStringUsername of an AhsayCBS System User with Admin, API or Read-Only API role.
SysPwdStringPassword matching SysUser.
RoleOnlyBooleanList the role of system users only (SystemUserRole).
HostStringAhsayCBS’s URL. It is required for calling API from Redirector only.
Return Values
KeyTypeDescription
StatusString"OK" or "Error"
DataArray of SystemUserRole or Array of SystemUserIf RoleOnly is true, an array of SystemUserRole is returned. Otherwise, an array of SystemUser is returned.
MessageStringError message, it only appears if status displays "Error".
ExptTypeStringThe type of exception, will only be displayed if the status is "Error".
JSON Objects

SystemUserRole

KeyTypeDescription
NameStringName of user role.
RoleStringThe value can be any one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY.

SystemUser

KeyTypeDescription
NameStringName of user.
RoleStringThe value can be any one of the following: ADMIN, READ_ONLY_ADMIN, RESELLER and API_ONLY.
StatusStringCan either be "SUSPENDED" or "ENABLED".
HashedPwdStringEncrypted (Hashed) password of the user.
IsShowRebrandingPagesBooleanTrue=Show Branding UI.
IsSendConsolidatedReportBooleanTrue=Send Consolidated Reports.
IsFreeTrialOfferAllowedBooleanTrue=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
		}
	]
}