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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...