Version: unstable
Curl example: "curl -X POST \\\nhttps://shopify.com/<shop-id>/account/customer/api/unstable/graphql/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'Authorization: {access_token}' \\\n-d '{\n\"query\": \"mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) { metafieldsSet(metafields: $metafields) { metafields { key namespace value createdAt updatedAt } userErrors { field message code } } }\",\n \"variables\": {\n \"metafields\": [\n {\n \"key\": \"nickname\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Big Tuna\"\n },\n {\n \"key\": \"title\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Dr.\"\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {\n metafieldsSet(metafields: $metafields) {\n metafields {\n key\n namespace\n value\n createdAt\n updatedAt\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"metafields\": [\n {\n \"key\": \"nickname\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Big Tuna\"\n },\n {\n \"key\": \"title\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Dr.\"\n }\n ]\n },\n },\n});\n" Ruby example: null PHP example: null Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await customer.graphql(\n `#graphql\n mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {\n metafieldsSet(metafields: $metafields) {\n metafields {\n key\n namespace\n value\n createdAt\n updatedAt\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"metafields\": [\n {\n \"key\": \"nickname\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Big Tuna\"\n },\n {\n \"key\": \"title\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Dr.\"\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {\n metafieldsSet(metafields: $metafields) {\n metafields {\n key\n namespace\n value\n createdAt\n updatedAt\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "metafields": [ { "key": "nickname", "namespace": "my_fields", "ownerId": "gid://shopify/Customer/624407574", "type": "single_line_text_field", "value": "Big Tuna" }, { "key": "title", "namespace": "my_fields", "ownerId": "gid://shopify/Customer/624407574", "type": "single_line_text_field", "value": "Dr." } ] }
response: { "data": { "metafieldsSet": { "metafields": [ { "key": "nickname", "namespace": "my_fields", "value": "Big Tuna", "createdAt": "2024-11-13T20:03:35Z", "updatedAt": "2024-11-13T20:03:38Z" }, { "key": "title", "namespace": "my_fields", "value": "Dr.", "createdAt": "2024-11-13T20:03:38Z", "updatedAt": "2024-11-13T20:03:38Z" } ], "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://shopify.com/<shop-id>/account/customer/api/unstable/graphql/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'Authorization: {access_token}' \\\n-d '{\n\"query\": \"mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) { metafieldsSet(metafields: $metafields) { metafields { key namespace value createdAt updatedAt } userErrors { field message code } } }\",\n \"variables\": {\n \"metafields\": [\n {\n \"key\": \"nickname\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Big Tuna\",\n \"compareDigest\": \"8ac49f51d020905227c0bc6d040a035396ec518dbda59d6bb53df3f718fb9f35\"\n },\n {\n \"key\": \"title\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Dr.\",\n \"compareDigest\": null\n }\n ]\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {\n metafieldsSet(metafields: $metafields) {\n metafields {\n key\n namespace\n value\n createdAt\n updatedAt\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n \"variables\": {\n \"metafields\": [\n {\n \"key\": \"nickname\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Big Tuna\",\n \"compareDigest\": \"8ac49f51d020905227c0bc6d040a035396ec518dbda59d6bb53df3f718fb9f35\"\n },\n {\n \"key\": \"title\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Dr.\",\n \"compareDigest\": null\n }\n ]\n },\n },\n});\n" Ruby example: null PHP example: null Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await customer.graphql(\n `#graphql\n mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {\n metafieldsSet(metafields: $metafields) {\n metafields {\n key\n namespace\n value\n createdAt\n updatedAt\n }\n userErrors {\n field\n message\n code\n }\n }\n }`,\n {\n variables: {\n \"metafields\": [\n {\n \"key\": \"nickname\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Big Tuna\",\n \"compareDigest\": \"8ac49f51d020905227c0bc6d040a035396ec518dbda59d6bb53df3f718fb9f35\"\n },\n {\n \"key\": \"title\",\n \"namespace\": \"my_fields\",\n \"ownerId\": \"gid://shopify/Customer/624407574\",\n \"type\": \"single_line_text_field\",\n \"value\": \"Dr.\",\n \"compareDigest\": null\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {\n metafieldsSet(metafields: $metafields) {\n metafields {\n key\n namespace\n value\n createdAt\n updatedAt\n }\n userErrors {\n field\n message\n code\n }\n }\n}"
input: { "metafields": [ { "key": "nickname", "namespace": "my_fields", "ownerId": "gid://shopify/Customer/624407574", "type": "single_line_text_field", "value": "Big Tuna", "compareDigest": "8ac49f51d020905227c0bc6d040a035396ec518dbda59d6bb53df3f718fb9f35" }, { "key": "title", "namespace": "my_fields", "ownerId": "gid://shopify/Customer/624407574", "type": "single_line_text_field", "value": "Dr.", "compareDigest": null } ] }
response: { "data": { "metafieldsSet": { "metafields": [ { "key": "nickname", "namespace": "my_fields", "value": "Big Tuna", "createdAt": "2024-11-13T20:03:38Z", "updatedAt": "2024-11-13T20:03:39Z" }, { "key": "title", "namespace": "my_fields", "value": "Dr.", "createdAt": "2024-11-13T20:03:39Z", "updatedAt": "2024-11-13T20:03:39Z" } ], "userErrors": [] } } }