I want to update multiple metafields of product which is shown at my web site at one api call.
Url : https://{…}:{…}@{…}myshopify.com/admin/api/2021-07/products/{productID}/metafields.json
const metafieldParam = {
metafield(s) : [
{
namespace : "Urls",
key : "image",
value : "",
type :
},
{
namespace : "Urls",
key : "video",
value : "",
type : "",
},
{
....
},
]
}
await fetch(url, {method : 'POST' , headers : {'Content-Type' : 'application/json', body:JSON.stringify(metafieldParam)})
but I get 400 bad request from shopify.
If I send request by only one param ( ex : param = {metafield : { namespace : … } } , It succeeds to update, but I want to update all metafields at one fetch call. Is this possible?
I tried these…
-
metafield(s)
-
param = { product : { metafields : { … } } },
-
param = { product { id : product_id ,{ metafields : { … } } }
-
PUT
-
POST
-
in url 2022-07
I appreciate your help !!!