Update contact sec. Amocrm?

Good day!
Need to when it comes to re-entry that focuses on phone number, contact details were updated and a new one created, the associated transaction. It is important that a new contact was not created.
Now the contact and the transaction is created perfectly, but when it comes to update the contact error Bad request error Code: 400.
Code below. Will drop some points, if you need to add to see:
if(empty($contact ID)){
$contact=array(
'name'=>$data['name'],
 'linked_leads_id' => array($lead_id),
'custom_fields'=>array(
array(
'id'=>1687949,
'values'=>array(
array(
'value'=>$data['email'],
'enum'=>'WORK'
)
)
)
)
);
$set['request']['contacts']['add'][]=$contact;
}else {

$contact = array('id' => $contact ID, 'linked_leads_id' => array($lead_id));


$set['request']['contacts']['update'][] = $contact;
}


Get the contact list by phone number. If contact with the received phone is not present, the variable contact ID is blank and create a new contact. There is no problem. If the contact is, the contact ID contact id is recorded with that number, it runs the update.
But he is not satisfied, the output error 400. The transaction is created, the contact no.
What could be the problem?
August 23rd 19 at 10:34
1 answer
August 23rd 19 at 10:36
Solution
$contact = array('id' => $contact ID, 'linked_leads_id' => array($lead_id));

$set['request']['contacts']['update'][] = $contact;

obligatory fields are missing, because 400

update/last_modified
Sure, it works, somehow I missed this moment) Thank you! - khalil.Schimmel49 commented on August 23rd 19 at 10:39

Find more questions by tags amoCRM