Register a new user on the server.

 

Syntax
{
  "cmd"        : "0010",
  "ServerKey"  : "iddqd",
  "APIStype"   : "php",

  "context"    : "myfunc",

 
  "Nick"       : "JohnSnow",

  "AuthType"   : 1,
  "Password"   : "mysecretword",
  "Email"      : "[email protected]",
  "Domain"     : "circle1.fbi.com",
  "FirstName"  : "John",
  "LastName"   : "Snow",
  "Sex"        : 1
}


Parameters

Parameter

Type

Value

cmd

string

"0010",  number of the command MCIAPI_CS_RegisterNewUser;

ServerKey

string

IntegrationAPI key, can be set in the server settings;

APIStype

string

integration type. You can set any string;

context

string

optional parameter, any text that returns in response command;

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;

Email

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",

  "context" : "myfunc",
  "UIN"  : 39,
  "Nick" : "JohnSnow"
}


Field

Type

Value

Cmd

integer

number of a command that was successfully executed, equal to 16 (HEX 0010);

context

string

any text sent to the server in a query command;

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'     => '[email protected]',
    '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

#5, MCIAPI_Error_WrongIntegrationKey

#9, MCIAPI_Error_API_Disabled

#10, MCIAPI_Error_ParameterAbsent

#14, MCIAPI_Error_NickAlreadyExists

#18, MCIAPI_Error_NickCannotBeEmpty

#21, MCIAPI_Error_WrongData

#44, MCIAPI_Error_ReservedNickName

#45, MCIAPI_Error_PasswordCannotBeEmpty

#46, MCIAPI_Error_DomainNickAlreadyExists

#47, MCIAPI_Error_ParameterIsEmpty

 

See also

MCIAPI_CS_GetUINByEmail

MCIAPI_CS_GetUINByNick