REST API "PUT" unable to update Product metafield

chcsep
Shopify Partner
79 3 28

I have tried everything but keep getting "Bad request" when I try to update a product metafield.

 

I have retrieved the Metafields for the product and selected the Metafield ID for the metafield I'm trying to update (it has an existing value)

 

My URL is in this format:

https://[API_key]@[storename].myshopify.com/admin/api/2023-04/products/[ProductID]/metafields/[MetafieldID].json

My CURL request is in this format:

-X PUT 
-H "Content-Type: application/json"
-d { "metafield": { "id": [MetafieldID], "value": "MyText" } )

And I've tried many variations, but I always get the unhelpful response "HTTP/1.1 400 Bad Request"

 

Does anyone know what I am doing wrong??

 

Edit: I was able to get a workaround by deleting the old metafield value, which permitted me to re-add the metafield to the product using the PUT command on products/[productid].json

Replies 0 (0)