Connector for commercetools Manual / Version 2307
Table Of ContentsThe eCommerce API is a Java API provided by CoreMedia Content Cloud that can be used to build shop applications.
The eCommerce API is used internally to render catalog-specific information into standard templates. Furthermore, the Studio Library integration makes use of the API to browse and work with catalog items. If you develop your own shop application you will use the API in your templates and/or business logic (handlers and beans).
Various services allow you to access the eCommerce system for different tasks:
CatalogService
- This service can be used to access the product catalog in many ways: traverse the category tree, products by category, various product and category searches.
MarketingSpotService
- This service gives you access to Commerce e-Marketing Spots, a common method to use marketing content (product teasers, images, texts) depending on the customer segments.
SegmentService
- This service lets you access customer segments, for example, the customer segments the current user is a member of.
CartService
- This service lets you manage orders.
AssetService
- This service lets you retrieve catalog assets, for example, product pictures or downloads, that are managed by the CMS. Unlike other services, this service only accesses the CMS.
The Commerce API includes some additional methods that denotes the vendor (the name, the version). In CoreMedia Studio there is an option to open a management application for a commerce item (product or category). The required base URL is also set through on the vendor specific connection.
The following key points will give you a short overview of the components that are also involved. They build up an infrastructure to bootstrap a connection to a commerce system and/or perform other supportive tasks.
Commerce
- This class is the essential part of the bootstrap mechanism to access a commerce system. You can use it to create a connection to your commerce system.
CommerceConnectionInitializer
-
This class is used to initialize a request specific commerce
connection.
The resolved connection is stored in a thread local variable.
The
CommerceConnection
class provides access to all vendor specific eCommerce service implementations. CommerceBeanFactory
-
This class creates
CommerceBeans
whose implementation is defined via Spring. It is also used by the services to respond service calls, for example, instances ofProduct
and/orCategory
beans. You can integrate your own commerce bean implementations via Spring (inheriting from the original bean implementation and place your own code would be a typical pattern). StoreContextProvider
-
This class retrieves an applicable
StoreContext
(the shop configuration that contains information like the shop name, the shop ID, the locale and the currency). UserContextProvider
-
This class is responsible to retrieve the current
UserContext
. Some operations, like requesting dynamic price information, demand a user login. These requests can be made on behalf of the requesting user. User name and user ID are then part of the user context. CommerceIdProvider
-
The class
CommerceIdProvider
is used to createCommerceId
instances. The classCommerceId
is able to format and parse references to resources in the commerce items. References to commerce items will be possibly stored in content, like a product teaser stores a link to the commerce product.
Commerce beans are cached depending on time. Cache time and capacity can be configured via Spring.
Please refer to the Javadoc of the Commerce
class as a good starting
point on how to use the eCommerce API.