If you are a regular reader of this blog, or indeed any reader of this blog, it is extremely likely that you will have no idea what the following few sentences mean. Don’t worry about it. I’m just dumping this into Google because I’ve spent the last four hours clawing at my head trying to solve a problem that is, to the best of my searching ability, undocumented anywhere else.
If you are trying to use the Magento XML-RPC (or SOAP) API to import new product data and keep getting the following error:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
Then it may help you to know that the catalog_product.create function takes an integer for its product attribute set ID, and that the key for the ‘Default’ set (as of Magento 1.3.2.4) is 4.
(If that doesn’t work and you recently upgraded, the most popular suggestion is to ensure that all your MySQL tables are InnoDB, but that wasn’t my problem.)