Model/Apiconnector/Client.php
public function postAddressBookContactsImport($filename, $addressBookId)
    {
        $url = $this->getApiEndpoint() . "/v2/address-books/{$addressBookId}/contacts/import";

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt(
            $ch,
            CURLOPT_USERPWD,
            $this->getApiUsername() . ':' . $this->getApiPassword()
        );

        //case the deprication of @filename for uploading
        if (function_exists('curl_file_create')) {
            $args['file']
                = curl_file_create(
                    $this->fileHelper->getFilePathWithFallback($filename),
                    'text/csv'
                );
            curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
        } else {
            //standart use of curl file
            curl_setopt($ch, CURLOPT_POSTFIELDS, [
                'file' => '@' . $this->fileHelper->getFilePathWithFallback($filename),
            ]);
        }

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, [
                'Content-Type: multipart/form-data',
            ]);
        // send contacts to address book
        $result = curl_exec($ch);
        $result = json_decode($result);

        if (isset($result->message)) {
            $message = 'postAddressBookContactsImport' . $addressBookId . ' file : ' . $filename
                . ' ,user : ' . $this->getApiUsername() . '. ' .  $result->message;
            $this->helper->debug('postAddressBookContactsImport', [$message]);
        }

        return $result;
    }
public function postAddressBookContactsImport($filename, $addressBookId)
    {
        $url = $this->getApiEndpoint() . "/v2/address-books/{$addressBookId}/contacts/import";

        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt(
            $ch,
            CURLOPT_USERPWD,
            $this->getApiUsername() . ':' . $this->getApiPassword()
        );

        //case the deprication of @filename for uploading
        if (function_exists('curl_file_create')) {
            $args['file']
                = curl_file_create(
                    $this->fileHelper->getFilePathWithFallback($filename),
                    'text/csv'
                );
            curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
        } else {
            //standart use of curl file
            curl_setopt($ch, CURLOPT_POSTFIELDS, [
                'file' => '@' . $this->fileHelper->getFilePathWithFallback($filename),
            ]);
        }

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_HTTPHEADER, [
                'Content-Type: multipart/form-data',
            ]);
        // send contacts to address book
        $result = curl_exec($ch);
        $result = json_decode($result);

        if (isset($result->message)) {
            $message = 'postAddressBookContactsImport' . $addressBookId . ' file : ' . $filename
                . ' ,user : ' . $this->getApiUsername() . '. ' .  $result->message;
            $this->helper->debug('postAddressBookContactsImport', [$message]);
        }

        return $result;
    }
public function postAddressBookContactsImport ( $ filename , $ addressBookId ) { $ url = $ this -> getApiEndpoint ( ) . "/v2/address-books/{$addressBookId}/contacts/import" ; $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , 'POST' ) ; curl_setopt ( $ ch , CURLOPT_USERPWD , $ this -> getApiUsername ( ) . ':' . $ this -> getApiPassword ( ) ) ; //case the deprication of @filename for uploading if ( function_exists ( 'curl_file_create' ) ) { $ args [ 'file' ] = curl_file_create ( $ this -> fileHelper -> getFilePathWithFallback ( $ filename ) , 'text/csv' ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ args ) ; } else { //standart use of curl file curl_setopt ( $ ch , CURLOPT_POSTFIELDS , [ 'file' => '@' . $ this -> fileHelper -> getFilePathWithFallback ( $ filename ) , ] ) ; } curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , false ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , [ 'Content-Type: multipart/form-data' , ] ) ; // send contacts to address book $ result = curl_exec ( $ ch ) ; $ result = json_decode ( $ result ) ; if ( isset ( $ result -> message ) ) { $ message = 'postAddressBookContactsImport' . $ addressBookId . ' file : ' . $ filename . ' ,user : ' . $ this -> getApiUsername ( ) . '. ' . $ result -> message ; $ this -> helper -> debug ( 'postAddressBookContactsImport' , [ $ message ] ) ; } return $ result ; }
Bulk creates, or bulk updates, contacts. Import format can either be CSV or Excel.
Must include one column called "Email". Any other columns will attempt to map to your custom data fields.
The ID of returned object can be used to query import progress.

@param string|int $filename
@param string|int $addressBookId

@return mixed
Bulk creates or bulk updates contacts . Import format can either be CSV or Excel . Must include one column called Email . Any other columns will attempt to map to your custom data fields . The ID of returned object can be used to query import progress .