Jump to content
Sign in to follow this  
WebhostingNZ.com

create client via API [resolved]

Recommended Posts

Hey, 

Hopefully, someone can help.  I am having trouble adding a client via the API, I keep getting the following error:

BlestaResponse Object ( [raw:BlestaResponse:private] => {"message":"An unexpected error occured.","response":"Internal error: Failed to retrieve the default value"} [response_code:BlestaResponse:private] => 500 )

My code is as follows:

require_once "blesta_api.php";
 
$user = '***';
$key = '***';
$url = "https://***/api/";
 
$api = new BlestaApi($url, $user, $key);


$data = array(
    'username' => 'daniel***.com',
    'new_password' => '****',
    'confirm_password' => '****',    
    'client_group_id' => '16',  
    'status' => 'active',
    'first_name' => 'Daniel',  
    'last_name' => '***', 
    'title' => 'Mr',
    'company' => 'MyCompany',
    'email' => 'daniel***.com',  
    'address1' => '1 street',  
    'address2' => 'somewhere',
    'city' => 'mycity', 
    'state' => '***',
    'zip' => '1111',  
    'country' => 'NZ',
    'numbers' => array (
            'type' => 'phone',
            'location' => 'home',
            'number' => '****',
        ),
    'settings' => array (
        'username_type' => 'email',
        'tax_exempt' => false,
        'tax_id' => '',
        'default_currency' => 'NZD',
        'language' => 'en_us',
        'receive_email_marketing' => true,
    ),
	'send_registration_email' => 'true',
);

$response = $api->get("clients", "create", $data);
print_r($response);

 

Thanks,
Daniel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×