S
S
Sergey Miller2022-02-05 17:19:36
css
Sergey Miller, 2022-02-05 17:19:36

Amo crm api v4 - how to find a contact by custom field?

When using api, at the time of creating a deal + contact + linking a contact to a deal, duplicate contacts are created. How to avoid it?

Trying to find a contact by phone number

$headers = [
    'Accept: application/json',
    'Authorization: Bearer ' . $access_token
    ];    

$contact_tell = '+7 (911) 111-11-11';
    $subdomain = 'xxxx';
        
        // fields
        
        $queryUrlExists = 'https://'.$subdomain.'.amocrm.ru/api/v4/contacts/?fields[223513]='.$contact_tell; //GET
        
        
        $curl2 = curl_init();
        curl_setopt($curl2, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl2, CURLOPT_USERAGENT, "amoCRM-API-client/1.0");
        curl_setopt($curl2, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($curl2, CURLOPT_HTTPGET, 1);
        curl_setopt($curl2, CURLOPT_URL, $queryUrlExists);
        curl_setopt($curl2, CURLOPT_HEADER, false);
        
        $out2 = curl_exec($curl2);
        curl_close($curl2);
        $result2 = json_decode($out2, true);
    
    
    echo '<pre>';
    print_r($result2);
    echo '</pre>';
    
    exit;


A blank page is returned. Help, who faced, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2016-01-21
@theWaR_13

there is no font-color, just color:white

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question