Hi,
I’m having problems creating a bulkOperationRunMutation request for a metafieldsSet operation. I’m following these instructions, and the API version being used is 2022-10.
I always get this error when running the bulkOperationRunMutation GraphQL request:
Unexpected file structure - expected JSONL
First of all, I’m not sure if the metafieldsSet operation is supported to run with bulkOperationRunMutation.
On the limitations section it does list metafieldsSet, so I would think it is supported. But on the Create a bulk operation mutation section, in the mutation parameter description it shows:
Specifies the GraphQL API mutation that you want to run in bulk. Valid values: productCreate, collectionCreate, productUpdate, productUpdateMedia, productVariantUpdate
So by reading this, it would seem that metafieldsSet is not supported. Would this explain the error? ![]()
I’m able to successfully run the example bulk mutation for productCreate - No errors here.
Since I’m doing initial testing, I’m only including one line in the JSONL file. I’ve tried these (and more) combinations:
{ "metafields": { "key": "has_sim_card_option", "value": "false", "namespace": "custom_fields", "ownerId": "gid://shopify/Product/22930626609410", "type": "boolean" } }
{ "key": "has_sim_card_option", "value": "false", "namespace": "custom_fields", "ownerId": "gid://shopify/Product/22930626609410", "type": "boolean" }
The GraphQL command:
mutation {
bulkOperationRunMutation(
mutation: "mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) { metafieldsSet(metafields: $metafields) { metafields { key namespace value createdAt updatedAt } userErrors { field message } } }",
stagedUploadPath: "tmp/gcs/123456789/bulk/replaced-just-in-case-abcde/metafields.jsonl"
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
Any assistance is appreciated, as it would be great if I could run the data changes in bulk.
Thanks!