Zurmo api add contact

182 views Asked by At

i am trying to add contacts into Zurmo with their api. Full documentation can be found here Login is successfull :

   Array
(
    [status] => SUCCESS
    [data] => Array
        (
            [sessionId] => 6qkdhn85vrn2kg37r7f690hu62
            [token] => bd64877aa701ee957105f5cbea91018c
        )

    [message] => 
    [errors] => 
)


$data = Array(
                    'firstName' => $fields['firstName'],
                    'lastName' => $fields['lastName'],
                    'jobTitle' => '',
                    'department' => $fields['rank'],
                    'officePhone' => $fields['businessPhone'],
                    'mobilePhone' => $fields['privatePhone'],
                    'officeFax' => '',
                    'description' => '',
                    'companyName' => '',
                    'website' => '',
                    'industry' => Array
                        (
                            'value' => ''
                        ),

                    'source' => Array
                        (
                            'value' => 'Outbound'
                        ),

                    'title' => Array
                        (
                            'value' => $fields['appeal']
                        ),

                    'state' => Array
                        (
                            'id' => 5
                        ),

                    'account' => Array
                        (
                            'id' => 1
                        ),

                    'primaryEmail' => Array
                        (
                            'emailAddress' => $fields['email'],
                            'optOut' => 1,
                        ),

                    'secondaryEmail' => Array
                        (
                            'emailAddress' => "",
                            'optOut' => 0,
                            'isInvalid' => 1,
                        ),

                    'primaryAddress' => Array
                        (
                            'street1' => $fields['street'],
                            'street2' => '',
                            'city' => $fields['city'],
                            'postalCode' => $fields['zipCode'],
                            'country' => $fields['country'],
                        ),

                    'secondaryAddress' => Array
                        (
                            'street1' => '',
                            'street2' => '',
                            'city' => '',
                            'postalCode' => '',
                            'country' => '',
                        ),
                );
                $data['modelRelations'] = array(
                    'opportunities' => array(
                        array(
                            'action' => 'add',
                            'modelId' => 3
                        ),
                    ),
                );
            $response = $this->createApiCall('http://zurmo_url/app/index.php/contacts/contact/api/create/', 'POST', $headers, array('data' => $data));
            $response = json_decode($response, true);

The url i added there is for demo purpose but i have put the correct url. The response i get back is

[status] => FAILURE
[data] => 
[message] => 
[errors] => 

Just failure nothing else. I am also receiving an error in error log

[Fri May 06 14:35:37.459049 2016] [fcgid:warn] [pid 31399] [client 86.123.146.201:53303] mod_fcgid: stderr: PHP Notice: Trying to get property of non-object in /var/www/clients/client0/web1/web/app/protected/config/common.php on line 145

Any ideeas why is this happening ?

0

There are 0 answers