MyChat Integration API: MCIAPI_CS_RegisterNewUser, register a new user
Register a new user on the server.
Syntax
{
"cmd" : "0010",
"ServerKey" : "iddqd",
"APIStype" : "mydata",
"Nick" : "JohnSmith",
"Password" : "mysecretword",
"Email" : "john@fbi.com",
"Domain" : "circle1.fbi.com",
"FirstName" : "John",
"LastName" : "Smith",
"MiddleName" : "M.",
"Sex" : 1,
"IP" : "192.168.10.137",
"NetName" : "comp01",
"ClientType" : "web",
"AuthType" : 0
}
Parameters
Parameter |
Type |
Value |
ServerKey |
string |
IntegrationAPI key, can be set in the server settings; |
APIStype |
string |
integration type. You can set any string; |
Nick |
string |
user nickname, this field is necessary and unique; |
Password |
string |
user's password. This field can be empty if a passwordless authorization is used; |
|
string |
user's email address. Unnecessary parameter; |
Domain |
string |
user's domain name. Unnecessary parameter; |
FirstName |
string |
user's name. Unnecessary parameter; |
LastName |
string |
user's last name. Unnecessary parameter; |
MiddleName |
string |
user's middle name. Unnecessary parameter; |
Sex |
integer |
user's gender. Unnecessary parameter. It set as "unspecified" by dfefault; |
AuthType |
integer |
user's authentication type, number. |
Work result
{
"cmd" : "0010",
"UIN" : 39,
"Nick" : "JohnSnow"
}
Field |
Type |
Value |
Cmd |
integer |
number of a command that was successfully executed, equal to 16 (HEX 0010); |
UIN |
integer |
unique identifier of the created user (UIN); |
Nick |
string |
user's nickname. |
Example of use on PHP language
<?php
$postData = (array // filling fields for a request
(
'cmd' => '0010',
'Nick' => 'JohnSnow',
'Password' => 'mysecretword',
'Email' => 'johnsnow@winterfell.com',
'FirstName' => 'John',
'LastName' => 'Snow',
'Sex' => 1,
'AuthType' => 0,
'APIStype' => 'php',
'ServerKey' => 'iddqd'
)
);
$myCurl = curl_init();
curl_setopt_array($myCurl, array(
CURLOPT_URL => 'https://192.168.10.133/API/', // specify an entrance path
CURLOPT_RETURNTRANSFER => true, // return a transfer result as a string
CURLOPT_SSL_VERIFYHOST => false, // disable SSL checking
CURLOPT_SSL_VERIFYPEER => false, // disable SSL checking
CURLOPT_POST => true, // enabling POST mode
CURLOPT_HEADER => true, // enabling headers
CURLOPT_HTTPHEADER => array('integrationapi: mychat'), // adding a !necessary! header — integrationapi: mychat
CURLOPT_POSTFIELDS => json_encode($postData) // enumeration of query data in a JSON format
));
$response = curl_exec($myCurl); // sending a query
if($response === FALSE){ // checking errors
die(curl_error($myCurl));
}
curl_close($myCurl); // closing a connection
echo $response; // outputting a response
Possible errors
MCIAPI_Error_Nick_Already_Exists
MCIAPI_Error_NickCannotBeEmpty
MCIAPI_Error_WrongIntegrationKey
See also
Created with the Personal Edition of HelpNDoc: Quickly and Easily Convert Your Word Document to an ePub or Kindle eBook