- Creating New User
[[API:Function]] – goAddUser
-
This application is used to create new User. Newly created user 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 – ID of the user. String
-
pass – Password for user. String
-
full_name – Full name for user. String
-
user_group – Assign the user group to specific user group. String
-
active - User status, values are Y or N. String
Returns:
result – “success” means that user has been created. String
result – “error” means that user has not been created, containing the error occurred. String
-
Error: Please Check your details and try again.
-
Error: User already exist.
-
Error: Invalid User group
-
Error: Special characters found in user/password/full name
-
Error: Set a value for User/ password/ full name/ user group
-
Error: Default value for active is Y or N only.
user – created user. Integer
Sample Code:
<code>
</code><?php
$url = "https://jameshv.goautodial.com/goAPI/goUsers/goAPI.php"; # URL to GoAutoDial API filem (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]
$postfields["responsetype"] = "json"; #response type by the [[API:Functions]]
$postfields["hostname"] = $_SERVER['REMOTE_ADDR']; #Default value
$postfields["user"] = ""; #Desired value for user (required)
$postfields["pass"] = ""; #Desired value for pass (required)
$postfields["full_name"] = ""; #Desired full name (required)
$postfields["user_group"] = ""; #Assign to user group (required)
$postfields["active"] = ""; #Y or N (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 ID: ";
} else {
# An error occured
echo $output->result;
}
?>
-
- Updating User
[[API:Function]] – goEditUser
-
This application is used to update a user. Only user 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 – ID for user. String
Returns:
result – “success” means that user has been updated. String
result – “error” means that user has not been updated, containing the error occurred. String
-
Error: Set a value for User ID.
-
Error: Special characters found in user/password/full_name/phone_login/phone_pass
-
Error: Default value for active is Y or N only.
-
Error: Default value for hotkeys_active is Y or N only.
-
Error: Default value for modify_same_user_level is Y or N only.
-
Error: User Level Value should be in between 1 and 9
-
Error: hotkeys is disabled
-
Error: modify_same_user_level is disabled
-
Error: User Group doesn't exist
-
Error: User doesn't exist.
-
Error: Update failed. Check your details
user – updated user. String
Sample Code:
<?php
$url = "https://jameshv.goautodial.com/goAPI/goUsers/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"] = ""; #Desired value for user (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 "Update Success";
} else {
# An error occured
echo $output->result;
}
?>
-
- Deleting User
[[API:Function]] – goDeleteUser
-
This application is used to delete a user. Only user 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 - ID for user. string
Returns:
result – “success” means that list has been updated successfully. String
result – “error” means that list has not been updated, containing the error occurred. String
user – deleted user. string
Sample Code:<?php
$url = "https://YOUR_URL/goAPI/goUsers/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"] = ""; #Desired User 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);
if ($output->result=="success") {
# Result was OK!
echo "User deleted successfully";
} else {
# An error occured
echo $output->result;
}
?>
-
- Displaying User
[[API:Function]] – goGetAllUserLists
-
This application is used to get list of user 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 – id of the user. String
full_name – full name of user. String
active – status of user. String
user_level – level of the user. Integer
user_group– Assign user group to specific user group. StringSample Code:
<?php
$url = "https://YOUR_URL/goAPI/goUsers/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->userno);$i++){
echo $output->userno[$i]."</br>";
echo $output->full_name[$i]."</br>";
echo $output->user_level[$i]."</br>";
echo $output->user_group[$i]."</br>";
echo $output->active[$i]."</br>";
}
} else {
# An error occured
echo "The following error occured: ".$results["message"];
}
?>
-
- Displaying User Information
[[API:Function]] – goGetUserInfo
-
Allows to retrieve some attributes of a given user. user 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 – id for user. 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 List ID.
-
Error: List doesn't exist.
user – id of the user. String
full_name – full name of user. String
active – status of user. String
user_level – level of the user. Integer
user_group– Assign user group to specific user group. StringSample Code:
<?php
$url = "https://YOUR_URL/goAPI/goUsers/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_id"] = $user_id; #Desired User ID (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);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
for($i=0;$i<count($output->userno);$i++){
echo $output->userno[$i]."</br>";
echo $output->full_name[$i]."</br>";
echo $output->user_level[$i]."</br>";
echo $output->user_group[$i]."</br>";
echo $output->active[$i]."</br>";
}
} else {
# An error occured
echo $output->result;
}
?>
-
USER
- 1030 Users Found This Useful