Insert User
It works in the same way as adding a new entry and has mandatory fields for user registration.
<?php
$item = array(
'group_id' => 4, //4 - User group ID
'firstname' => 'Сергей',
'lastname' => 'Харчишин',
'username' => 'admin',
'email' => 'support@rukovoditel.net',
'password' => '', //If not specified, it will be generated automatically.
);
$params = array(
'key' => 'XgDXFsTbNRkMpRq81bBrmRAf56i5oS0oN9bp4jLH',
'username' => 'manager',
'password' => 'manager',
'action' => 'insert',
'entity_id' => 1,
'notify' =>true, //A notification will be sent to the user.
'login_url' => 'http://localhost/rukovoditel/index.php',
'items' => $item ,
);
$ch = curl_init('http://localhost/rukovoditel/api/rest.php');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$result = curl_exec($ch);
curl_close($ch);
if($result)
{
$result = json_decode($result,true);
print_r($result);
}
Field | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
entity_id | Must be 1 | ||||||||||||||
notify | To send a notification to the user's mail (true/false) | ||||||||||||||
login_url | The login link is added to the user notification. | ||||||||||||||
items | An array of records, including the fields of the record. | ||||||||||||||
field_X - the field to add, where X is the field ID. The field ID can be found on the "Field Configuration" page. This field takes a value as a string.
|