如何使用shopify API批量更新产品元字段

如何使用shopify API批量更新产品元字段,shopify,shopify-app,Shopify,Shopify App,我想使用Shopify Rest API批量更新产品元字段 此代码一次只更新一个元字段。 { "metafield": { "namespace": "custom_fields", "key": "aa_percentage", "value": "2345", "value_type": "string" } } { "metafield": { "name

我想使用Shopify Rest API批量更新产品元字段

此代码一次只更新一个元字段。

{
  "metafield": 
      { 
       "namespace": "custom_fields",
        "key": "aa_percentage",
        "value": "2345",
        "value_type": "string"
        }

}
{
  "metafield": 
      { 
       "namespace": "custom_fields",
        "key": "aa_percentage",
        "value": "2345",
        "value_type": "string"
        },
      { 
       "namespace": "custom_fields",
        "key": "cc_percentage",
        "value": "2345",
        "value_type": "string"
        }                           


}
我尝试过这种方法,不幸的是不起作用。

{
  "metafield": 
      { 
       "namespace": "custom_fields",
        "key": "aa_percentage",
        "value": "2345",
        "value_type": "string"
        }

}
{
  "metafield": 
      { 
       "namespace": "custom_fields",
        "key": "aa_percentage",
        "value": "2345",
        "value_type": "string"
        },
      { 
       "namespace": "custom_fields",
        "key": "cc_percentage",
        "value": "2345",
        "value_type": "string"
        }                           


}

此方法将不起作用,因为它不可用。Shopify文档中没有针对API的批量更新操作。此外,如果您查看一下,一次只能添加、编辑和更新一个元字段

{
  "metafield": {
    "id": 721389482,
    "value": "something new",
    "value_type": "string"
  }
}
但这并不意味着您必须等待每次调用才能发布下一次更新。您可以同时生成多个更新调用。这样做可以通过多种方式实现,比如使用多个使用者进程或JavaScript中的承诺推入队列

下面是NodeJS中使用的示例代码


此方法将不起作用,因为它不可用。Shopify文档中没有针对API的批量更新操作。此外,如果您查看一下,一次只能添加、编辑和更新一个元字段

{
  "metafield": {
    "id": 721389482,
    "value": "something new",
    "value_type": "string"
  }
}
但这并不意味着您必须等待每次调用才能发布下一次更新。您可以同时生成多个更新调用。这样做可以通过多种方式实现,比如使用多个使用者进程或JavaScript中的承诺推入队列

下面是NodeJS中使用的示例代码


你能给我举个例子吗?那太好了。