To prevent DDOS attacks, it is not allowed to perform too many operations one after the other. If too many API calls are made one after the other, you may be temporarily blocked. For importing/editing a large number of articles or customers, it is therefore better to forward them in bulk. This allows you to list the items/customers as a list of max. Pass on 100 items.
To pass on the data in bulk, use the option '?bulk' as a POST method. You pass on the list of items along "clients" or "stock items" respectively.
To update data instead of creating it, the id of the customer (client_id) or the article (stockitem_id) is provided.
$data['clients'] = [ (object)[ "name" => "IT Services BVBA" ], (object)[ "client_id" => 11111, "name" => "Demo Company" ], ]; $p = curl_init('https://app.simplybooks.be/api/v1/clients?bulk'); curl_setopt($p, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json')); curl_setopt($p, CURLOPT_USERPWD, $email . ':' . $password); curl_setopt($p, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($p, CURLOPT_RETURNTRANSFER, TRUE); $result = json_decode(curl_exec($p));
Or in XML:
<clients> <client> <name>IT Services BVBA</name> ... </client> <client> <name>Demo Company</name> ... </client> </clients>