Users

Modified on Wed, 16 Aug 2023 at 03:44 PM

Our users API can be used to add and manage users for AtomChat


1. List Users

For listUser:

POST - https://api.cometondemand.net/api/v2/listUsers



<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/listUsers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "offset=0&limit=100",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
curl --request POST \
--url https://api.cometondemand.net/api/v2/listUsers \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data offset=0 \
--data limit=100


POST

Header Parameters
required
String
Your API Key

Form Parameters
required
Number
Page offset

required
Integer
The maximum number of results


Sample code


var myHeaders = new Headers();
myHeaders.append("api-key", "Your-API-KEY");
var formdata = new FormData();
formdata.append("offset", "");
formdata.append("limit", "");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://api.cometondemand.net/api/v2/listUsers", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));


Header Parameters - api-key 


Form Parameters 

  1. Page offset – offset (Optional) 
  2. The maximum number of results – limit (Optional)


2. Create Users

For CreateUser:

POST - https://api.cometondemand.net/api/v2/createUser



<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/createUser",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/createUser \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'



Header Parameters – api-key 

Form Parameters 

  1. The Unique User ID – UID (Required) 
  2. User's Name – name (Required) 
  3. User's Avatar URL (Image) – avatarURL (Optional)
  4. User's Profile URL – profileURL (Optional)
  5. User's Role – role (Optional)
  6. User’s Email – email (Optional)



Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Unique User ID

optional
String
User's Name

optional
String
User's Avatar URL (Image)

optional
String
User's Profile URL

optional
String
User's Role (e.g. Administrator, Editor, Premium Member)

optional
String


3. Get User

For getUser:

POST - https://api.cometondemand.net/api/v2/getUser 



<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/getUser",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "returnFriends=false&returnJoinedGroups=false",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
curl --request POST \
--url https://api.cometondemand.net/api/v2/getUser \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data returnFriends=false \
--data returnJoinedGroups=false




Header Parameters


optional
String
Your API Key

Form Parameters
optional
String
The Unique User ID

optional
Boolean
Get list of friends

optional
Boolean
Get list of groups user is part of


Header Parameters – api-key 

Form Parameters

  1. Mandatory UID - UID
  2. optionalString - returnFriends - true or false
  3. optionalString - returnJoinedGroups - true or false


4. Get User Status

POST - https://api.cometondemand.net/api/v2/getUserStatus


Returns status and number of active conversations for a given set of users


<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/getUserStatus",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/getUserStatus \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'




Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
UIDs (Comma Separated)

Header Parameters – api-key 


Form Parameters 

  1. Mandatory UIDs - UIDs (comma separated)


5. Delete User

POST - https://api.cometondemand.net/api/v2/deleteUser


<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/deleteUser",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/deleteUser \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'

Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Unique User ID

Header Parameters – api-key 


Form Parameters 

  1. Mandatory UID - UID



6. Update User

POST - https://api.cometondemand.net/api/v2/updateUser


<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/updateUser",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/updateUser \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'

Header Parameters


optional
String
Your API Key

Form Parameters
optional
String
The Unique User ID

optional
String
User's Name

optional
String
User's Avatar URL (Image)

optional
String
User's Profile URL

optional
String
User's Role (e.g. Administrator, Editor, Premium Member)

Header Parameters – api-key 


Form Parameters 

  1. The Unique User ID – UID (Required) 
  2. User's Name – name (Optional) 
  3. User's Avatar URL (Image) – avatarURL (Optonial) 
  4. User's Profile URL – profileURL (Optonial) 
  5. User's Role – role (Optonial) 
  6. User’s Email – email (Optional)

7. Add Friends

POST - https://api.cometondemand.net/api/v2/addFriends


<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/addFriends",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/addFriends \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'


Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Unique User ID

optional
String
Friends' UID (Comma Separated)

optional
Boolean
Set to 1 if you would like to erase existing friends


Header Parameters – api-key 


  1. Mandatory Friends’ UID - friendsUID (Comma Separated ) 
  2. Optional - clearExisting - true or false (Default false)



8. Delete Friends


POST - https://api.cometondemand.net/api/v2/deleteFriends


<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/deleteFriends",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/deleteFriends \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'




Header Parameters


optional
String
Your API Key

Form Parameters
optional
String
The Unique User ID

optional
String
Friends' UID (Comma Separated)

Header Parameters – api-key 


  1. Mandatory UID – UID 
  2. Mandatory Friends’ UID - friendsUID (Comma Separated )

9. Block User

POST - https://api.cometondemand.net/api/v2/blockUser


<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/blockUser",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/blockUser \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'



Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The UID initiating the block

optional
String
The UID of the user being blocked

Unblock User 

POST - https://api.cometondemand.net/api/v2/unblockUser


<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometondemand.net/api/v2/unblockUser",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


curl --request POST \
--url https://api.cometondemand.net/api/v2/unblockUser \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded'

Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The UID initiating the block

optional
String
The UID of the user getting unblocked

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article