Loading...
 
Skip to main content

Api Groups Doc

Retrieve groups.


Retrieve a list of user groups with pagination and optional filtering.


Request URL - groups
Copy to clipboard
https://example.com/api/groups


cURL - groups
Copy to clipboard
curl --request GET \ --url "https://example.com/api/groups" \ --data-urlencode "offset=-1" \ --data-urlencode "maxRecords=3" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>"


PHP - groups
Copy to clipboard
<?php $base_url = 'https://example.com/api/groups'; $params = [ 'offset' => -1, 'maxRecords' => 3 ]; $url = $base_url . '?' . http_build_query($params); $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - groups
Copy to clipboard
const params = new URLSearchParams({ offset: '-1', maxRecords: '3' }); fetch('https://example.com/api/groups?' + params.toString(), { method: 'GET', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>' } }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - groups
Copy to clipboard
{ "data": [ { "id": 1, "groupName": "Anonymous", "groupDesc": "Public users not logged", "groupHome": null, "usersTrackerId": null, "groupTrackerId": null, "usersFieldId": null, "groupFieldId": null, "registrationChoice": null, "registrationUsersFieldIds": null, "userChoice": null, "groupDefCat": 0, "groupTheme": "", "groupColor": "", "isExternal": "n", "expireAfter": 0, "emailPattern": "", "anniversary": "", "prorateInterval": "", "isRole": "n", "isTplGroup": "n", "perms": [ "tiki_p_admin_tikitests", "tiki_p_download_files", "tiki_p_edit_tikitests", "tiki_p_export_pdf", "tiki_p_play_tikitests", "tiki_p_print", "tiki_p_search", "tiki_p_view" ], "permCount": 8, "included": [], "included_direct": [] }, { "id": 2, "groupName": "Registered", "groupDesc": "Users logged into the system", "groupHome": null, "usersTrackerId": null, "groupTrackerId": null, "usersFieldId": null, "groupFieldId": null, "registrationChoice": null, "registrationUsersFieldIds": null, "userChoice": null, "groupDefCat": 0, "groupTheme": "", "groupColor": "", "isExternal": "n", "expireAfter": 0, "emailPattern": "", "anniversary": "", "prorateInterval": "", "isRole": "n", "isTplGroup": "n", "perms": [ "tiki_p_admin_tikitests", "tiki_p_edit_tikitests", "tiki_p_export_pdf", "tiki_p_play_tikitests", "tiki_p_print", "tiki_p_view_category" ], "permCount": 6, "included": [ "Anonymous" ], "included_direct": [ "Anonymous" ] }, { "id": 3, "groupName": "Admins", "groupDesc": "Administrator and accounts managers.", "groupHome": null, "usersTrackerId": null, "groupTrackerId": null, "usersFieldId": null, "groupFieldId": null, "registrationChoice": null, "registrationUsersFieldIds": null, "userChoice": null, "groupDefCat": 0, "groupTheme": "", "groupColor": "", "isExternal": "n", "expireAfter": 0, "emailPattern": "", "anniversary": "", "prorateInterval": "", "isRole": "n", "isTplGroup": "n", "perms": [ "tiki_p_admin", "tiki_p_admin_tikitests", "tiki_p_edit_tikitests", "tiki_p_export_pdf", "tiki_p_play_tikitests", "tiki_p_print", "tiki_p_remove_share", "tiki_p_view_category" ], "permCount": 8, "included": [], "included_direct": [] } ], "count": 5 }




Parameters

  • offset integer optional : Offset to start from
  • maxRecords integer optional : Maximum number of records to return
  • find string optional : Search string to filter groups
  • initial string optional : Initial string to match group names

Create a new user group


Create a new user group with optional configuration parameters.


Request URL - groups
Copy to clipboard
https://example.com/api/groups


cURL - groups
Copy to clipboard
curl --request POST \ --url "https://example.com/api/groups" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "name=Test Group" \ --data-urlencode "userChoice=y" \ --data-urlencode "desc=Test Group Description"


PHP - groups
Copy to clipboard
<?php $url = 'https://example.com/api/groups'; $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>', 'Content-Type: application/x-www-form-urlencoded' ]; $postFields = http_build_query([ 'name' => 'Test Group', 'userChoice' => 'y', 'desc' => 'Test Group Description' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - groups
Copy to clipboard
const params = new URLSearchParams({ name: 'Test Group', userChoice: 'y', desc: 'Test Group Description' }); fetch('https://example.com/api/groups', { method: 'POST', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: params.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - groups
Copy to clipboard
{ "feedback": { "action": [ { "type": "feedback", "icon": "success", "title": "Success", "mes": [ "Group Test Group (ID 6) successfully created" ] } ] } }




Request body

  • name string *: The name of the group
  • desc string optional : The description of the group
  • home string optional : The home page of the group
  • userstracker integer optional : The tracker ID for the users. Choose a user tracker to provide fields for a new user to complete upon registration.
  • usersfield integer optional : The field ID for the users. Select the user selector field from the above tracker (userstracker) to link a tracker item to the user upon registration.
  • groupstracker integer optional : The tracker ID for the group.
  • groupfield integer optional : The field ID for the group. Select the group selector field from the above tracker (groupstracker) to link a tracker item to the group upon registration.
  • registrationUsersFieldIds string optional : If either a group information tracker or user registration tracker has been selected above, enter colon-separated field ID numbers for the tracker fields in the above tracker to include on the registration form for a new user to complete.
  • userChoice string optional : User can assign himself or herself to the group. Possible values are:
    • y : Yes. User can assign himself or herself to the group
    • n : No. User cannot assign himself or herself to the group.
  • defcat integer optional : The Default category assigned to uncategorized objects edited by a user with this default group.
  • theme string optional : The theme of the group. Possible values are:
    • default : Default theme.
    • custom_url : Custom theme by specifying URL
    • amelia : Amelia theme.
    • cerulean : Cerulean theme.
    • cosmo : Cosmo theme.
    • cyborg : Cyborg theme.
    • darkly : Darkly theme.
    • flatly : Flatly theme.
    • etc. (see https://bootswatch.com/Question for more themes)
  • expireAfter integer optional : Number of days after which all users will be unassigned from the group.
  • emailPattern string optional : Users are automatically assigned at registration in the group if their emails match the pattern.
    • Example: /@(tw.org$)|(tw.com$)/
  • anniversary string optional : Use MMDD to specify an annual date as of which all users will be unassigned from the group, or DD to specify a monthly date.
  • prorateInterval string optional : The Payment for membership extension is prorated at a minimum interval. Possible values are:
    • day : Daily prorate interval.
    • month : Monthly prorate interval.
    • year : Yearly prorate interval.
  • color string optional : The Default color to use when plotting values for this group in charts. Use HEX notation, e.g. #FF0000 for red color.
  • isRole string optional : The group is a role. Possible values are:
    • y : Yes. The group is a role.
    • n : No. The group is not a role.
    • Note: If the group is a role, it will be used to assign permissions to users. Role groups can't have users.
  • isTplGroup string optional : The group is a template group. Possible values are:
    • y : Yes. The group is a template group.
    • n : No. The group is not a template group.
  • include_groups[] array optional : The groups to include in this group. Consider it as a parent group, the group from which this group inherits permissions.

Update an existing user group


Update an existing user group’s configuration, description, or name.


Request URL - groups
Copy to clipboard
https://example.com/api/groups/{olgroup}


cURL - groups
Copy to clipboard
curl --request POST \ --url "https://example.com/api/groups/Test%20Group" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "isRole=y" \ --data-urlencode "name=Test Group Updated" \ --data-urlencode "userChoice=n" \ --data-urlencode "desc=Test Group Description Updated"


PHP - groups
Copy to clipboard
<?php $url = 'https://example.com/api/groups/Test%20Group'; $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>', 'Content-Type: application/x-www-form-urlencoded' ]; $postFields = http_build_query([ 'isRole' => 'y', 'name' => 'Test Group Updated', 'userChoice' => 'n', 'desc' => 'Test Group Description Updated' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } } curl_close($ch); ?>


Javascript - groups
Copy to clipboard
const params = new URLSearchParams({ isRole: 'y', name: 'Test Group Updated', userChoice: 'n', desc: 'Test Group Description Updated' }); fetch('https://example.com/api/groups/Test%20Group', { method: 'POST', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: params.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - groups
Copy to clipboard
{ "feedback": { "action": [ { "type": "feedback", "icon": "success", "title": "Success", "mes": [ "Group Test Group Updated successfully modified" ] } ] } }



Parameters

  • olgroup string *: The original name of the group to update

Request body

  • name string optional : The name of the group
  • desc string optional : The description of the group
  • home string optional : The home page of the group
  • userstracker integer optional : The tracker ID for the users. Choose a user tracker to provide fields for a new user to complete upon registration.
  • usersfield integer optional : The field ID for the users. Select the user selector field from the above tracker (userstracker) to link a tracker item to the user upon registration.
  • groupstracker integer optional : The tracker ID for the group.
  • groupfield integer optional : The field ID for the group. Select the group selector field from the above tracker (groupstracker) to link a tracker item to the group upon registration.
  • registrationUsersFieldIds string optional : If either a group information tracker or user registration tracker has been selected above, enter colon-separated field ID numbers for the tracker fields in the above tracker to include on the registration form for a new user to complete.
  • userChoice string optional : User can assign himself or herself to the group. Possible values are:
    • y : Yes. User can assign himself or herself to the group
    • n : No. User cannot assign himself or herself to the group.
  • defcat integer optional : The Default category assigned to uncategorized objects edited by a user with this default group.
  • theme string optional : The theme of the group. Possible values are:
    • default : Default theme.
    • custom_url : Custom theme by specifying URL
    • amelia : Amelia theme.
    • cerulean : Cerulean theme.
    • cosmo : Cosmo theme.
    • cyborg : Cyborg theme.
    • darkly : Darkly theme.
    • flatly : Flatly theme.
    • etc. (see https://bootswatch.com/Question for more themes)
  • expireAfter integer optional : Number of days after which all users will be unassigned from the group.
  • emailPattern string optional : Users are automatically assigned at registration in the group if their emails match the pattern.
    • Example: /@(tw.org$)|(tw.com$)/
  • anniversary string optional : Use MMDD to specify an annual date as of which all users will be unassigned from the group, or DD to specify a monthly date.
  • prorateInterval string optional : The Payment for membership extension is prorated at a minimum interval. Possible values are:
    • day : Daily prorate interval.
    • month : Monthly prorate interval.
    • year : Yearly prorate interval.
  • color string optional : The Default color to use when plotting values for this group in charts. Use HEX notation, e.g. #FF0000 for red color.
  • isRole string optional : The group is a role. Possible values are:
    • y : Yes. The group is a role.
    • n : No. The group is not a role.
    • Note: If the group is a role, it will be used to assign permissions to users. Role groups can't have users.
  • isTplGroup string optional : The group is a template group. Possible values are:
    • y : Yes. The group is a template group.
    • n : No. The group is not a template group.
  • include_groups[] array optional : The groups to include in this group. Consider it as a parent group, the group from which this group inherits permissions.

Add one or more users to a specified group.


Add one or more users to a specified group.


Request URL - groups
Copy to clipboard
https://example.com/api/groups/add_users


cURL - groups
Copy to clipboard
curl --request POST \ --url "https://example.com/api/groups/add_users" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "group=Test Group Updated" \ --data-urlencode "items[]=test-user" \ --data-urlencode "items[]=test-user-2"


PHP - groups
Copy to clipboard
<?php $url = 'https://example.com/api/groups/add_users'; $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>', 'Content-Type: application/x-www-form-urlencoded' ]; $postFields = http_build_query([ 'group' => 'Test Group Updated', 'items' => ['test-user', 'test-user-2'] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($status === 200) { echo json_encode(json_decode($response, true), JSON_PRETTY_PRINT); } else { echo "Error: HTTP $status"; } } curl_close($ch); ?>


Javascript - groups
Copy to clipboard
const params = new URLSearchParams({ group: 'Test Group Updated', 'items[]': 'test-user', 'items[]': 'test-user-2' }); fetch('https://example.com/api/groups/add_users', { method: 'POST', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: params.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.error('Fetch error: ' + err.message); });


Response - groups
Copy to clipboard
{ "feedback": { "action": [ { "type": "feedback", "icon": "success", "title": "Success", "mes": [ "The following user was added to group Test Group Updated:" ], "items": [ "test-user", "test-user-2" ] } ] } }



Request body

  • group string *: The name of the group to which users will be added
  • items[] array *: The usernames of the users to add

Ban one or more users from a specified group.


Ban one or more users from a specified group.


Request URL - groups
Copy to clipboard
https://example.com/api/groups/ban_users


cURL - groups
Copy to clipboard
curl --request POST \ --url "https://example.com/api/groups/ban_users" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "group=Test Group Updated" \ --data-urlencode "items[]=test-user" \ --data-urlencode "items[]=test-user-2"


PHP - groups
Copy to clipboard
<?php $url = 'https://example.com/api/groups/ban_users'; $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>', 'Content-Type: application/x-www-form-urlencoded' ]; $postFields = http_build_query([ 'group' => 'Test Group Updated', 'items' => ['test-user', 'test-user-2'] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error: ' . curl_error($ch); } else { $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($status === 200) { echo json_encode(json_decode($response, true), JSON_PRETTY_PRINT); } else { echo "Error: HTTP $status"; } } curl_close($ch); ?>


Javascript - groups
Copy to clipboard
const params = new URLSearchParams({ group: 'Test Group Updated', 'items[]': 'test-user', 'items[]': 'test-user-2' }); fetch('https://example.com/api/groups/ban_users', { method: 'POST', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: params.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.error('Fetch error: ' + err.message); });


Response - groups
Copy to clipboard
{ "feedback": { "action": [ { "type": "feedback", "icon": "success", "title": "Success", "mes": [ "The following user was banned from group Test Group Updated:" ], "items": [ "test-user", "test-user-2" ] } ] } }



Request body

  • group string *: The name of the group from which users will be banned
  • items[] array *: The usernames of the users to ban


Delete one or more groups from the system.


Delete one or more groups from the system.


Request URL - groups
Copy to clipboard
https://example.com/api/groups/delete


cURL - groups
Copy to clipboard
curl --request POST \ --url "https://example.com/api/groups/delete" \ --header "accept: application/json" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "items[]=Test Group Updated" \ --data-urlencode "items[]=Translators Group"


PHP - groups
Copy to clipboard
<?php $url = 'https://example.com/api/groups/delete'; $data = http_build_query([ 'items' => ['Test Group Updated', 'Translators Group'] ]); $headers = [ 'Accept: application/json', 'Authorization: Bearer <API_TOKEN>', 'Content-Type: application/x-www-form-urlencoded' ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code === 200) { $data = json_decode($response, true); print_r($data); } else { echo 'Error: HTTP status code ' . $http_code; } curl_close($ch); ?>


Javascript - groups
Copy to clipboard
const formData = new URLSearchParams(); formData.append('items[]', 'Test Group Updated'); formData.append('items[]', 'Translators Group'); fetch('https://example.com/api/groups/delete', { method: 'POST', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer <API_TOKEN>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: formData.toString() }) .then(res => { if (!res.ok) throw new Error("HTTP " + res.status); return res.json(); }) .then(data => { console.log(data); }) .catch(err => { console.log('Fetch error: ' + err.message); });


Response - groups
Copy to clipboard
{ "feedback": { "action": [ { "type": "feedback", "icon": "success", "title": "Success", "mes": [ "The following group has been deleted:" ], "items": [ "Test Group Updated", "Translators Group" ] } ] } }



Request body

  • items[] array *: The list of group names to delete



Show PHP error messages