Implementing two-way catalog synchronization with a PIM system
PIM (Product Information Management) — centralized product data repository: Akeneo, Pimcore, Plytix, Syndigo. The main value of PIM is one source of truth for all sales channels: website, marketplaces, printed catalogs. Integrating a website with PIM means the website always displays current enriched data.
Integration architecture with Akeneo
Akeneo provides REST API version 1.0+:
GET /api/rest/v1/products — product list
GET /api/rest/v1/products/{code} — specific product
GET /api/rest/v1/product-models — models (for variant products)
GET /api/rest/v1/categories — category tree
GET /api/rest/v1/attributes — attribute schema
GET /api/rest/v1/families — product families
Authentication via OAuth2 with client credentials flow.
Paginated import
class AkeneoSyncService
{
private AkeneoClient $client;
public function syncProducts(): void
{
$cursor = null;
do {
$response = $this->client->getProducts([
'limit' => 100,
'search' => json_encode(['enabled' => [['operator' => '=', 'value' => true]]]),
'search_after'=> $cursor,
]);
foreach ($response['_embedded']['items'] as $item) {
$this->upsertProduct($item);
}
$nextLink = $response['_links']['next']['href'] ?? null;
$cursor = $nextLink ? $this->extractCursor($nextLink) : null;
} while ($cursor !== null);
}
private function upsertProduct(array $akeneoProduct): void
{
// Extract localized values
$values = $akeneoProduct['values'];
$name = $this->getLocaleValue($values, 'name', 'ru_RU');
$desc = $this->getLocaleValue($values, 'description', 'ru_RU');
$price = $this->getScopedValue($values, 'price', 'ecommerce');
Product::updateOrCreate(
['akeneo_code' => $akeneoProduct['identifier']],
compact('name', 'desc', 'price') + [
'family' => $akeneoProduct['family'],
'categories' => $akeneoProduct['categories'],
'raw_values' => $values, // JSONB — full PIM data
'synced_at' => now(),
]
);
}
private function getLocaleValue(array $values, string $attr, string $locale): ?string
{
return collect($values[$attr] ?? [])
->firstWhere('locale', $locale)['data'] ?? null;
}
}
Webhook from Akeneo (real-time changes)
Akeneo Enterprise supports event subscriptions:
// Handler for incoming events from Akeneo
Route::post('/webhooks/akeneo', function (Request $request) {
$signature = $request->header('X-Akeneo-Request-Signature');
if (!hash_equals(
hash_hmac('sha256', $request->getContent(), config('akeneo.webhook_secret')),
$signature
)) {
abort(401);
}
foreach ($request->json('events') as $event) {
match($event['action']) {
'product.created', 'product.updated' =>
SyncAkeneoProduct::dispatch($event['resource']['identifier']),
'product.removed' =>
Product::where('akeneo_code', $event['resource']['identifier'])
->update(['active' => false]),
};
}
return response('ok');
});
Reverse synchronization: site → PIM
Data generated by the site with value for PIM: ratings, view counts, conversion data. Written via Akeneo API as custom attributes.
Timeline
Integration with Akeneo PIM (one-way): 6–10 days. Two-way with webhook support: 10–16 days.







