Jump to content

Phone Number Not Adding When Creating Clients Via The Api


Recommended Posts

Posted

I am passing the client data via the below array to the clients::create() method:

$data = array (
            'vars' => array (
                        'username' => $user_data['username'],
                        'new_password' => $password,
                        'confirm_password' => $password,
                        'client_group_id' => 1,
                        'first_name' => $user_data['first_name'],
                        'last_name' => $user_data['last_name'],
                        'company' => $company_name,
                        'address1' => $user_data['address'],
                        'city' => $user_data['city'],
                        'state' => $user_data['state_iso'],
                        'zip' => $user_data['zip_code'],
                        'country' => $user_data['country_iso'],
                        'email' => $user_data['email'],
                        'numbers' => array (
                                        'number' => $user_data['phone']
                                    ),
                        'settings' => array (
                                        'send_registration_email' => false
                                    )
                    )
        );

Everything gets stored correctly other than the phone - am I doing something wrong there?

 

Thanks!

Posted

The number structure should be

[numbers] => Array (
  [0] => stdClass Object (
    [number] => 256632541
    [type] => phone
    [location] => home
   )
  [1] => stdClass Object (
    [number] => 145236222
    [type] => fax
    [location] => home
   )
 
)

try

$data = array (
            'vars' => array (
                        'username' => $user_data['username'],
                        'new_password' => $password,
                        'confirm_password' => $password,
                        'client_group_id' => 1,
                        'first_name' => $user_data['first_name'],
                        'last_name' => $user_data['last_name'],
                        'company' => $company_name,
                        'address1' => $user_data['address'],
                        'city' => $user_data['city'],
                        'state' => $user_data['state_iso'],
                        'zip' => $user_data['zip_code'],
                        'country' => $user_data['country_iso'],
                        'email' => $user_data['email'],
                        'numbers' => array (
                                        '0' => array (
                                               'number' => $user_data['phone']
                                         ),
                                    ),
                        'settings' => array (
                                        'send_registration_email' => false
                                    )
                    )
        );

the numbers should be a incremental array

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...
×
×
  • Create New...