API:addClient - Add new client
Creates new client, params described are minimum set of params, each HostBill can use different registration fields, codes(keys) of which can be used here to fill customer details
Required parameters
- firstname
- Client firstname
- lastname
- Client lastname
- email
- Client email address
- password
- client password
- password2
- password confirmation (same as password)
Optional parameters
- notify
- Set to 1 if you wish to send customer his login details
- phonenumber
- Client phone number
- type
- Client type - Private or Company values allowed here
- address1
- Address line 1
- address2
- Address line 2
- city
- City
- state
- State
- postcode
- ZIP / Postal code
- country
- Country ISO code - i.e: GB, US etc.
- companyname
- Customer's company name (if any)
Request
GET http://url_to_your_hostbill.com/admin/api.php?api_id=API_ID&api_key=API_KEY&call=addClient&firstname=FIRSTNAME&lastname=LASTNAME&email=EMAIL&password=PASSWORD&password2=PASSWORD2
<?php
include 'class.hbwrapper.php';
HBWrapper::setAPI('http://url_to_hb.com/admin/api.php','API ID','API Key');
$params = array(
'firstname'=>FIRSTNAME,
'lastname'=>LASTNAME,
'email'=>EMAIL,
'password'=>PASSWORD,
'password2'=>PASSWORD2
);
$return = HBWrapper::singleton()->addClient($params);
print_r($return);
?>
<?php
$url = 'http://url_to_hb.com/admin/api.php';
$post = array(
'api_id' => API_ID,
'api_key' => API_Key,
'call' => 'addClient',
'firstname'=>FIRSTNAME,
'lastname'=>LASTNAME,
'email'=>EMAIL,
'password'=>PASSWORD,
'password2'=>PASSWORD2
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($ch);
curl_close($ch);
$return = json_decode($data, true);
print_r($return);
?>
<?php
/* Use this method to access HostBill api from HostBill modules */
$api = new ApiWrapper();
$params = array(
'firstname'=>FIRSTNAME,
'lastname'=>LASTNAME,
'email'=>EMAIL,
'password'=>PASSWORD,
'password2'=>PASSWORD2
);
$return = $api->addClient($params);
print_r($return);
?>
Response
{
"success": true,
"client_id": "14",
"call": "addClient",
"server_time": 1323785423,
"info": [
"New client account created"
]
}