<< Click to Display Table of Contents >> Navigation: Journalytix API > Register Customer/Employee |
The Register Customer/Employee API is used to automatically register employees or customers to a corporate Journalytix account. This is generally done if the employees or customers are registering on the companies site, it makes no sense for them to register twice. In addition, this give you a 'point of registration' way to determine if their username already exists on the Journalytix servers.
The parameters to send to register a customer are as follows:
Company ID - admin user id of company on the Journalytix system
Company Password - password of the admin user for the company on the Journalytix system
API Code - API code for the company
Employee First Name
Employee Last Name
Employee Email Address
Start Date
End Date
Employee User Name - User name to be created in Journalytix
Employee Password - Password to be created in Journalytix
Account Provider ID - Provider ID of the account (e.g CQG, GAIN, JIGSAW_SIM, MT4, MT5, NT8, Rithmic, Tradovate, TTAPI, TTRESTAPI)
Account Name - Account number of the account
The End Date, Account Provider ID & Account Name are optional properties.
The validation rules are:
- user and email address cannot exist on any user currently registered
- company member, user and API code must match
Error Codes
01 - User already registered with user name user name
02 - User name belongs to a different email address
03 - API Code not valid
04 - Invalid user name or password
05 - Valid user already exists
06 - User Exists, please use Invite API (Click here for invite API details)
07 - Number of registered employees exceeded. License allows xxxx where xxxx is number of registered
Emails - Added on 29/09/2022
The user will now receive an email consisting his credentials to login to member site / Journalytix, which was set during API call.
Sample PHP Code for Posting to the API is here
<?php ini_set('error_reporting', '1');
function callAPI($url, $data){ $curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
// OPTIONS: curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// EXECUTE: $result = curl_exec($curl); if(!$result){die("Connection Failure");} curl_close($curl); return $result; }
$data_array = array( "compName" => "testCompany", // Company Username "compPassword" => "Test123", // Company Password "compAPICode" => "b473a036-ca41-11e9-a1af-2c44fd1b8980", // Company API Code "empFirstName" => "Test", // Employee First Name "empLastName" => "User", // Employee Last Name "empEmail" => "test@user.com", // Employee Email Address "empUsername" => "testUser", // Employee User Name you want to create "empPassword" => "employeeTest", // Employee Password "startDate" => "2019-11-01", // Start Date for Employee on Platform "endDate" => "2019-12-01", // End date for Employee on platform (Optional) "accProvider" => "GAIN", // Type Of Account Provider (Optional) "accountName" => "TestUserNew" // Name of Trade Account (Optional) );
$url = 'http://dev.journalytix.com/api/CreateUser'; $make_call = callAPI($url, json_encode($data_array)); echo $make_call;
/* AccountProvider LIST - CQG - GAIN - JIGSAW_SIM - MT4 - MT5 - NT8 - Rithmic - Tradovate - TTAPI - TTRESTAPI
Errors List 'empFirstName.required' => 'Employee First Name Required.' 'empLastName.required' => 'Employee Last Name Required.' 'empEmail.required' => 'Employee Email Required.' 'empEmail.email' => 'Please Enter Correct Employee Email.' 'empUsername.required' => 'Employee Username Required.' 'empPassword.required' => 'Employee Password Required.' 'startDate.required' => 'Start Date Required.' "01"=>"user already registered with user name {provided in response}" "02"=>"user name already belongs to a different email address" "03"=>"API code not valid" "04"=>"Invalid username or password" "05"=>"valid user already exists" "06"=>User Exists, please use Invite API (Click here for invite API details)" "07"=>"valid user already exists" "aMemberAPI not working." "Company does not exist in member table."
Success Response "Employee has been added successfully."
*/
?>
d.' "01"=>"user already registered with user name {provided in response}" "02"=>"user name already belongs to a different email address" "03"=>"API code not valid" "04"=>"Invalid username or password" "05"=>"valid user already exists" "aMemberAPI not working." "Company does not exist in member table."
Success Response "Employee has been added successfully."
*/
?>
|
You can test adding a customer via the API here: