loading table of contents...

5.8. The e-Commerce API

The e-Commerce API is a Java API provided by CoreMedia DXP 8 that can be used to build shop applications. Various services allow you to access the e-Commerce system for different tasks:

  • The CatalogService can be used to access the product catalog in many ways: traverse the category tree, products by category, various product and category searches.

  • With the PriceService you can access prices: list prices and dynamic offer prices.

  • The AvailabilityService lets you access the inventory of the e-Commerce system to check the availability of Stock Keeping Units (SKUs).

  • The MarketingSpotService gives you access to IBM WCS e-Marketing Spots, a common method to use marketing content (product teasers, images, texts) depending on the customer segments.

  • The SegmentService lets you access customer segments, for example, the customer segments the current user is a member of.

  • Use the CartService to manage orders.

  • The WorkspaceService lets you retrieve the list of existing workspaces. A workspace is a concept to prepare changes in a separated branch/environment. A selected workspace is part of the current store context you work with.

The e-Commerce 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).

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.

  • The Commerce 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.

  • The CommerceConnectionInitializer is used to initialize a request specific commerce connection. The resolved connection is stored in a thread local variable.

  • The CommerceBeanFactory creates CommerceBeans whose implementation is defined via Spring. It is also used by the services to respond service calls, for example, instances of Product and/or Category 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).

  • The StoreContextProvider can retrieve an applicable StoreContext (the shop configuration that comprises information like the shop name, the shop id, the locale and the currency).

  • The UserContextProvider 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.

  • The CommerceIdProvider is able to format and parse references to 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 on time basis. 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 e-Commerce API'.