API Request to create a new user in Grupo Chatroom.

Request URL
https://yourgrupowebsiteaddress/api_request/

Request body

FieldDescription/ValuesRequired/Optional
api_secret_keyYour Grupo API Secret Key. For API Secret Key, Click on Menu > Select Settings > Select General Settings > Find API Secret KeyRequired
addsite_usersRequired
full_nameThe name of the userRequired
usernameUsername for the userRequired
email_addressThe email address of the userRequired
passwordPassword for the userRequired
site_roleFor Site Role ID : Click on Menu > Select Modules > Select Site Roles > Click on Site Role you Prefer > Select Edit > Find “Identifier”Optional
avatarURLThe URL for the user’s avatar imageOptional
custom_field_[id]Replace [id] with Custom field ID.
For Custom Field ID : Click on Menu > Select Modules > Select Custom Field > Click on Custom Field you Prefer to Add > Select Edit > Find “Identifier”.
Optional

Response Body

KEYDescription/Values
successThis returns true on success and false on failure.
error_messageReturns a relevant error message
error_keyThis method returns the error key associated with the error

Example PHP Code

<?php

$grupo_web_address = 'https://yourgrupowebsiteaddress'; 

$post_fields=[
  'api_secret_key' => 'Your_Grupo_API_Secret_Key',
  'add' => 'site_users',
  'full_name' => 'Full Name',
  'username' => 'username',
  'email_address' => '[email protected]',
  'password' => 'password',
  'avatarURL' => 'https://avatar_image_url',
  'site_role' => '',
  'custom_field_1' => 'About Me',
];

$api_request_url = rtrim($grupo_web_address, '/').'/'.'api_request/';

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => $api_request_url,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $post_fields,
  CURLOPT_USERAGENT=>'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0'
));


$response = curl_exec($curl);

curl_close($curl);

if (!empty($response)) {
    $response = json_decode($response);
    if (!empty($response)) {
        if ($response->success) {
            echo "User Account Created";
        } else {
            echo $response->error_message;
        }
    }
}
?>