As with Content Events (Commerce 10) and Service API (3) | Optimizely Dev we are using the Service API to update the catalog in Optimizely. This works fine, but we have hooked into IContentEvents, more specifically we are using PublishedContent, DeletedContent and MovedContent, but none of these events are fired, when the catalog is updated via Service API. We are running Commerce 13.31 and Service APi 5.5.1 and from the post, I mention above, it should work when using Service API 5.2 and later?
How do you setup Service API (on the same site or on a separate site), and how do you listen to events?
We are running the Service API on the same site and we listen to the events like this. It works fine when we do "manually" updates in the catalog.
[ServiceConfiguration(typeof(ContentEventIndexMediator), Lifecycle = ServiceInstanceScope.Singleton)]
public class ContentEventIndexMediator
private readonly IContentEvents _contentEvents;
private readonly ISettingsService _settingsService;
_contentEvents = contentEvents;
_settingsService = settingsService;
public void AddContentEvents()
bool indexingIsEnabled = _settingsService.GetSettingAsBool("indexing:enable-content-events");
_contentEvents.PublishedContent += UpdateIndex;
_contentEvents.DeletedContent += DeleteFromIndex;
_contentEvents.MovedContent += MovedContent;
_contentSecurityRepository.ContentSecuritySaved += UpdateIndex;
Yes it should fire content events. I'm not sure why it does not in your case. please reach out to developer support service for further assistance.
Optimizely Support wrote the following, hence the conclusion is, that we should use the same approach as in Content Events (Commerce 10) and Service API (3) | Optimizely Dev, meaning we should use EventContext.EntryUpdated.
When using bulk import with XML file, it would be the same when you import catalog in Commerce Managerhttps://webhelp.optimizely.com/19-6/en/commerce/catalog-management/importing-and-exporting-a-catalog.htmService API just is a wrapper in this case, and as it's the legacy system Commerce Manager, we don't change it to use IContentRepository About the changes in Service API 5.2, it's actually for Get, Post, Put, Delete API not for the import
Yeah if you were using the catalog import API then it's (Still) only low level events. Only when you use the CRUD APIs, content events can be used.