Groups

Modified on Fri, 28 Oct 2022 at 01:20 PM

You can use our Groups API to create groups programmatically and manage group users!

Let's dive-in!

Create Group

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

POS
curl --request POST \
  --url https://api.cometondemand.net/api/v2/createGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/createGroup",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

optional
String
The name of the group

optional
Integer
The type of group: 0 -> Public group, 1 -> Password protected group, 4 -> Private group

optional
String
The password required to join the group (only if type is 1)

optional
String
You have to pass the UID of a user for this field. createdby is for the owner of the group and if it is not passed, then the group is considered system created. If it is passed, then the user whose UID is added will be considered the group owner for that particular group. 

Delete Group

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

POST
curl --request POST \
  --url https://api.cometondemand.net/api/v2/deleteGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
JavaScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/deleteGroup",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

Add Users to Group

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

POS
curl --request POST \
  --url https://api.cometondemand.net/api/v2/addUsersToGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data clearExisting=false
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/addUsersToGroup",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "clearExisting=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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

optional
String
Users' UID (Comma Separated)

optional
Boolean

Remove Users From Group

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

curl --request POST \
  --url https://api.cometondemand.net/api/v2/removeUsersFromGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/removeUsersFromGroup",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

optional
String
Users' UID (Comma Separated)

List Groups

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

curl --request POST \
  --url https://api.cometondemand.net/api/v2/getGroupList \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/getGroupList",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
Comma separated GUIDs (optional)

List Group Members

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

curl --request POST \
  --url https://api.cometondemand.net/api/v2/getGroupUserList \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/getGroupUserList",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
Comma separated GUIDs

Ban Users From Group

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

curl --request POST \
  --url https://api.cometondemand.net/api/v2/banUsersFromGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/banUsersFromGroup",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

optional
String
Users' UID (Comma Separated)

Kick Users From Group

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

curl --request POST \
  --url https://api.cometondemand.net/api/v2/kickUsersFromGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/kickUsersFromGroup",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

optional
String
Users' UID (Comma Separated)

Unban Users From Group

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

curl --request POST \
  --url https://api.cometondemand.net/api/v2/unbanUsersFromGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/unbanUsersFromGroup",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

optional
String
Users' UID (Comma Separated)

Update Group

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

GE
curl --request POST \
  --url https://api.cometondemand.net/api/v2/updateGroup \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded'
TypeScript
Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cometondemand.net/api/v2/updateGroup",
  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;
}
PHP
Copy
Header Parameters
optional
String
Your API Key

Form Parameters
optional
String
The Group Unique ID

optional
String

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

Feedback sent

We appreciate your effort and will try to fix the article