Changes comparison
In order to avoid updating the entire Deante product database, we recommend introducing product version comparison into the integration system. For each product sent in the API, you can easily calculate the checksum (we recommend md5). If the checksum of the incoming product in the API differs from the one stored in the database, we update the product information.
Implementations
JavaScript
import md5 from 'md5'// Downloaded product from customer databaseconst databaseProduct = { // Product information + additional md5 field versionHash: "78e731027d8fd50ed642340b7c9a63b3"}// Product downloaded from Deante APIconst apiProduct = { // Product information from API Deante}const apiHash = md5(JSON.stringify(apiProduct));const hasChanged = databaseProduct.versionHash !== apiHash// If a change occurs hasChanged will be set to true// This means that this product should be updated
PHP
// Downloaded product from customer database$databaseProduct = array( // Product information + additional md5 field versionHash => "78e731027d8fd50ed642340b7c9a63b3");// Product downloaded from Deante API$apiProduct = array( // Product information from API Deante);$apiHash = md5(json_encode(apiProduct));$hasChanged = $databaseProduct['versionHash'] !== $apiHash// If a change occurs hasChanged will be set to true// This means that this product should be updated