- Creating New User Group
[[API:Function]] – goAddUserGroup
-
This application is used to create new user group . Newly created user group belongs to user that authenticated a request.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
user_group – user group. String
-
group_name – name of user group. String
Returns:
result – “success” means that user group has been created. String
result – “error” means that user group has not been created, containing the error occurred. String
-
Error: User Group ID field is required.
-
Error: User Group is Minimun of 3 characters.
-
Error: Special characters found in user_group
-
Error: Special characters found in group_name
-
Error: User Group already exist.
-
Error: Please check your details.
user_group – created user group. Integer
Sample Code:
<?php
$url = "https://jameshv.goautodial.com/goAPI/goUserGroups/goAPI.php"; # URL to GoAutoDial API file
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]
$postfields["responsetype"] = "json"; #json. (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$postfields["user_group"] = ""; #Assign to user group (required)
$postfields["group_name"] = ""; #Desired name (required)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
echo "Added New User Group ID ";
} else {
# An error occured
echo $output->result;
}
?>
-
- Updating User Group
[[API:Function]] – goEditUserGroup
-
This application is used to update a user group. Only user group that belongs to authenticated user can be updated.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
user_group – user group. String
Returns:
result – “success” means that user group has been updated successfully. String
result – “error” means that user group has not been updated, containing the error occurred. String
-
Error: Set a value for User Group.
-
Error: Special characters found in user_group
-
Error: Special characters found in group_name
-
Error: Group Level Value should be in between 1 and 9
-
Error: Default value for a forced_timeclock_login is Y, N or ADMIN_EXEMPT only.
-
Error: Default value for shift_enforcement is OFF, START or ALL only.
-
Error: Failed Update, Check your details
-
Error: User Group doesn't exist
user_group – updated user group. String
Sample Code:
<?php$url = "https://jameshv.goautodial.com/goAPI/goUserGroups/goAPI.php"; # URL to GoAutoDial API file
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]
$postfields["responsetype"] = "json"; #json. (required)
$postfields["user_group"] = ""; #Desired user group (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$postfields["group_name"] = ""; #Desired name (required)
$postfields["group_level"] = ""; #Desired level (required)
$postfields["forced_timeclock_login"] = ""; #Y, N or ADMIN_EXEMPT (required)
$postfields["shift_enforcement"] = ""; #OFF, START or ALL only. (required)
user_group, group_name, group_level, forced_timeclock_login, shift_enforcement
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
echo "Update Success";
} else {
# An error occured
echo $output->result;
}
?>
-
- Deleting User Group
[[API:Function]] – goDeleteUserGroup
-
This application is used to delete a user group. Only user group that belongs to authenticated user can be delete.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
user_group – user group. String
Returns:
result – “success” means that user group has been deleted successfully. String
result – “error” means that user group has not been deleted, containing the error occurred. String
-
Error: Set a value for user group.
-
Error: user group doesn't exist.
user_group – deleted user_group.String
Sample Code:<?php
$url = "https://YOUR_URL/goAPI/goUserGroups/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$postfields["user_group"] = ""; #Desired User Group. (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
echo "User Group deleted successfully";
} else {
# An error occured
echo $output->result;
}
?>
-
- Displaying User Groups
[[API:Function]] – goGetUserGroupsList
-
This application is used to get list of user group belongs to user.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
Returns:
result – “success” means that query was successful. String
result – “error” means that query was not successful. , containing the error occurred. String
user_group– user_group. String
group_name – name of user group. String
group_type – type of user group. String
forced_timeclock_login – forced time lock. String
Sample Code:
<?php
$url = "https://YOUR_URL/goAPI/goUserGroups/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
if ($output->result=="success") {
# Result was OK!
for($i=0;$i<count($output->user_group);$i++){
echo $output->user_group[$i]."</br>";
echo $output->group_name[$i]."</br>";
echo $output->group_type[$i]."</br>";
echo $output->forced_timeclock_login[$i]."</br>";
}
} else {
# An error occured
echo "The following error occured: ".$results["message"];
}
?>
-
- Displaying User Groups Information
[[API:Function]] – goGetUserGroupInfo
-
Allows to retrieve some attributes of a given user group. User group should belong to the user that authenticated the request.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
-
user_group –user group. String
Returns:
result – “success” means that query was successful. String
result – “error” means that query was not successful., containing the error occurred. String
-
Error: Set a value for user group
-
Error: user group doesn't exist.
user_group– user_group. String
group_name – name of user group. String
group_type – type of user group. String
forced_timeclock_login – forced time lock. String
Sample Code:
<?php
$url = "https://YOUR_URL/goAPI/goUserGroups/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$postfields["agent_id"] = ""; #Desired Agent ID. (required)
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
for($i=0;$i<count($output->user_group);$i++){
echo $output->user_group[$i]."</br>";
echo $output->group_name[$i]."</br>";
echo $output->group_type[$i]."</br>";
echo $output->forced_timeclock_login[$i]."</br>";
}
} else {
# An error occured
echo $output->result;
}
?>
-
USER GROUP
- 989 Users Found This Useful