SaaS CMS has officially launched! Learn more now.

Service API bulk catalog import fails to create relations


We are having an issue with our product import. We are using Service API bulk import to import a catalog.xml file that has both entries and relations in it.

I have been investigating this for a couple of days and I'm stuck. The XML we send looks good and if I import it again (via Service API or Commerce Manager) the relations are correctly created. No matter how many times I try to import it again, I never get the behaviour that relations are missing. It's only when I run through our job that send them in in batches of 500 products and 250 relations that I get the error. And it's not even the same files / products that causes it, it seems random, which is a headache. I tried to turn down the batch size to 1 but to my surprise I still got missing relations.

What I have now turned to that at least works, is bulk importing the entries and then using Service API REST API to create the relations.

What I do to debug it is to look in the relations table and see if there are any new products (the import resets the create date to today) that does not have a parent.

select *
from CatalogEntry CE
left join CatalogEntryRelation R on CE.CatalogEntryId = R.ChildEntryId
where StartDate > '2020-09-02'
and R.ParentEntryId is null and ClassTypeId = 'Variation'

Edited, Sep 04, 2020 13:58

Tobias, is that you?

ServiceAPI uses CatalogImportExport internally. Do you have any event listener for relation events? Would you be able to log any exception that might occur?

Sep 22, 2020 9:08

Hey Quan,

Nice to see you again :)

We do have our own event listeners but disabling them makes no difference. Service API log does not log any errors, warnings or even info that would help diagnosing this issue.
Looking at SQL profiler I can see that no relations are inserted/updated, so something is amiss in the import process. And I can reproduce the behaviour using Commerce Manager as well.

All in all I'm very stuck, but at least I have my workaround which is still working and I'm gonna leave this as I don't have the time to try and reproduce it on a vanilla Commerce site.

Sep 24, 2020 8:07
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.