Andrew Longland
Andrew Longland

Reputation: 11

Big Commerce API - Update Product Custom Field - 422 Error

I'm trying to build an integration for a client between Big Commerce and their ERP system. As part of this, I need to update existing custom fields against products in Big Commerce.

The API reference (https://developer.bigcommerce.com/api-reference/store-management/catalog/product-custom-fields/updatecustomfield) states that this is possible. I have built the integration code to use the exact method described in the API reference but it keeps returning a 422 error which says: The custom field with the name: xxxxxxxxx & value: yyyyyy already exists.

I don't understand why it would give this error; I know it exists, that's why I'm updating it. If it didn't exist, I would be using the Create Custom Field method instead.

Anyone ever come across this issue before or know why this may be occurring?

Thanks in advance.

Upvotes: 1

Views: 463

Answers (1)

Alex Hellier
Alex Hellier

Reputation: 485

I've found the API to be fairly robust, and use the custom_field API a LOT.

Have you done a quick check, via the API to get ALL the custom_fields for the product you are trying to update the custom_field for, and make sure you are updating by the correct custom_field ID? (so, not trying to change a different custom_field, which will then cause this error to be raised?)

Upvotes: 1

Related Questions