An entry in the application can be updated by ID or by field value. For example, you can update all records with a certain status.

Update records example:

<?php
$data = array(
  'field_235' => '9,10,11',
);

$params = array(
  'key' => 'MjBm7iKWaEubxvLvVW1lF5HFbrWzOFILh216iGKJ',  
  'username' => 'admin',
  'password' => 'admin',
  'action' => 'update',
  'entity_id' => 21,
  'data' => $data,
  'update_by_field' => ['field_156'=>34],
);
						                                    
$ch = curl_init('http://localhost/rukovoditel/product_2.5/api/rest.php');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);			
$result = curl_exec($ch);
curl_close($ch);

if($result)
{
  $result = json_decode($result,true);  
}

 

Field Description
entity_id Entity ID which needs to update
data Array of fields which need to update. System fields can be updated:
created_by, parent_item_id, password
update_by_field The field by which the record will be updated. You can update a record by ID or by field value, such as updating all records with a specific status.
Примеры  
'update_by_field' => ['id'=>37] Update record where ID = 37
'update_by_field' => ['id'=>[37,38]], Update record where ID 37  and  38
'update_by_field' => ['field_156'=>34] Update records where field number 156 is set to 34