What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

REST API adding metafields to products

REST API adding metafields to products

barrya_
Visitor
2 0 2

I've noticed some unexpected behavior when adding a metafield to a product using the metafields REST API.

 

I'm making a POST to the following url: .../admin/api/2024-01/products/1234567890/metafields.json

 

I'm receiving a create (201) status code for each call, even if there is an existing matching metafield assigned to the product. I'd assumed I would receive an error if I attempted to add a metafield that existed. Is this by design, i.e. if you try to add an existing metafield it replaces the pre-existing?

 

Thanks

Replies 0 (0)