Integrating product data from multiple platforms is a common challenge in ecommerce. Klizer needed to retrieve product data from Akeneo PIM and Magento, ensuring a seamless and unified response.
Initially, we encountered issues retrieving Akeneo’s product attributes, such as color, weight, and size. To overcome this, we adopted a hybrid approach, combining REST API calls for Akeneo and GraphQL queries for Magento using GraphQL Mesh.
ON THIS PAGE
What is GraphQL Mesh?
GraphQL Mesh is an open-source tool that enables seamless data integration from multiple sources, regardless of whether they are GraphQL, REST, gRPC, SOAP, or other APIs. It provides a unified GraphQL interface, allowing developers to query different data sources as if they were a single GraphQL API.
Key Benefits of GraphQL Mesh
- Unified API Interface – Combines multiple APIs (GraphQL, REST, SOAP) into a single GraphQL schema.
- Schema Stitching – Merges data from different sources dynamically without requiring backend modifications.
- Flexibility & Extensibility – Allows custom resolvers and transformation of APIs to suit business requirements.
- Improved Performance – Optimizes API requests, reducing multiple calls and enhancing data retrieval speed.
- Developer-Friendly – Reduces the complexity of managing different API types and makes data queries more intuitive.
Comparison with the Traditional REST API Approach
GraphQL Mesh provides several advantages over the traditional REST API approach by enabling a more flexible and unified way to interact with different data sources. Below are a few points where MESH gives better results than REST API
1. Unified API for Multiple Data Sources
GraphQL Mesh:
- Combines multiple APIs (REST, GraphQL, gRPC, SOAP, databases, etc.) into a single GraphQL endpoint.
- Provides a seamless way to query multiple services in one request.
REST API:
- Requires multiple API calls to fetch data from different services.
- No built-in mechanism for aggregating APIs into a single interface.
2. Better Performance with Fewer API Calls
GraphQL Mesh:
- Allows batching and parallel execution of requests.
- Uses intelligent caching to reduce redundant requests.
REST API:
- Multiple endpoints require sequential API calls, leading to higher latency.
3. Real-Time Capabilities
- GraphQL Mesh: Supports real-time data fetching via subscriptions and WebSockets.
- REST API: No built-in real-time support; requires polling or WebSocket implementation.
4. Reduces Over-Fetching & Under-Fetching
- GraphQL Mesh: Clients can query exactly what they need, reducing unnecessary data transfer.
- REST API: Fixed endpoints often return extra data (over-fetching) or lack necessary fields (under-fetching), requiring additional requests.
Challenges Faced in Akeneo Product Attributes [In Detail]
We initially attempted to retrieve product data from Akeneo PIM and Magento using GraphQL Mesh alone. While we successfully fetched product details from Magento, Akeneo’s product attributes were missing. Since Akeneo primarily uses REST APIs, we had to explore an alternative approach to retrieve attribute data effectively.
1. Our Hybrid Approach
To resolve this, we adopted the following solution:
- Use GraphQL Mesh to fetch general product information from Akeneo PIM and Magento.
- Make an additional REST API call to Akeneo to retrieve product attributes.
- Merge the data using a custom resolver in GraphQL Mesh to provide a unified response.
2. Impact We Made
- Successfully integrated Akeneo PIM and Magento into a single GraphQL API.
- Combined data from GraphQL and REST APIs without modifying backend systems.
- Enabled seamless retrieval of detailed product attributes and descriptions.
- Improved API efficiency by reducing redundant queries and minimizing response times.
- Provided a scalable integration framework for future multi-platform expansions.
3. Optimizing Performance with Redis Cache
We implemented Redis Cache for product data retrieval in the front end to improve its performance. The caching mechanism works as follows:
- When a frontend page requests product information, it first checks Redis Cache for the data using the product SKU as the key.
- If data exists in the cache, it is immediately returned, and a background process updates the cache by fetching the latest product details from the GraphQL API.
- If data is not in the cache, the request is forwarded to the GraphQL Mesh API, the data is fetched and stored in Redis for future requests.
- This ensures faster response times while keeping product information up to date.
Benefits of Redis Caching
- Reduced API Load – Minimizes frequent requests to GraphQL Mesh.
- Faster Response Time – Cached product data is served instantly, improving front-end performance.
- Efficient Data Synchronization – Background updates ensure that the cache remains fresh.
Available Solutions for Akeneo and Magento Synchronization
Several solutions are available in the market for integrating Akeneo PIM with Magento. These solutions aim to synchronize product data, attributes, categories, and media efficiently between the two platforms. Here are some of the most widely used options:
1. Akeneo Connector for Magento (Official Extension)
Akeneo offers an official Magento connector, which provides a native synchronization solution between Akeneo PIM and Magento.
Features:
- Direct integration with Magento via API.
- Supports product, attribute, and category synchronization.
- Allows automatic updates from Akeneo to Magento.
- Includes mapping and transformation options for product data.
Limitations:
- Requires Magento Enterprise Edition for full features.
- Complex to configure for custom data structures.
2. Third-Party Connectors (Paid Extensions)
Several Magento extension providers offer Akeneo integration plugins, such as:
- Webkul Akeneo Magento Connector
- Firebear Studio Akeneo Connector
- CustomGento Akeneo2Magento Connector
Features:
- Quick and easy setup.
- Pre-built mapping and automation features.
- Supports multiple store views and multi-language data sync.
Limitations:
- Paid extensions with license costs.
- Does not support all Akeneo/Magento customizations.
GraphQL Mesh vs Traditional Extensions vs REST API Integration
GraphQL Mesh is far better then others like Traditional Extensions or REST API solutions. Below are only a few points.
Feature | GraphQL Mesh | Traditional Extensions (e.g., Webkul, Firebear) | REST API Integration |
Integration Type | Middleware-based (GraphQL + REST) | Direct module-based sync | API-based custom development |
Data Retrieval Method | Merges data from multiple sources dynamically | Uses predefined Akeneo API calls | Fetches data via REST API endpoints |
Flexibility & Customization | Highly flexible, allows schema transformations & custom resolvers | Limited to module features | Requires heavy custom coding |
Performance Optimization | Uses caching (Redis) & schema stitching for optimized performance | No built-in caching relies on Magento’s indexing | Requires additional caching mechanisms |
Real-time Data Fetching | Supports real-time queries and background sync | Data sync is periodic (scheduled jobs) | Requires manual or scheduled API sync |
Multi-Source Support | Can merge data from Akeneo, Magento, PIMs, ERPs, and REST APIs | Works only with Akeneo & Magento | Can integrate with multiple APIs but requires additional development |
Ease of Maintenance | Easier to update & modify using schema transformations | Requires frequent extension updates | High maintenance for API modifications |
Dependency on Magento/Akeneo Versions | Works independently of Magento/Akeneo updates | May require extension updates for compatibility | Version updates may break API requests |
Cost & Licensing | Open-source, only infra costs (Redis, Node.js) | Paid extensions with license fees | Custom development costs |
Integrate Akeneo PIM with GraphQL Mesh in Magento 2 with Klizer
By leveraging GraphQL Mesh, we effectively bridged the gap between Akeneo’s REST API and Magento’s GraphQL API. This hybrid approach allowed us to integrate multiple data sources, ensuring a flexible, efficient, and scalable product data management solution.
GraphQL Mesh is an excellent choice for businesses that rely on multiple APIs and seek a unified, high-performance, and developer-friendly solution for integrating diverse data sources.Reach out to Klizer, your Adobe Commerce Solutions Partner to help you integrate Akeneo PIM with GraphQL Mesh in the Magento 2 platform.