metaobject Bulk Deletemutation
mutation
2024-10latest
Requires write
access scope.
Asynchronously delete metaobjects and their associated metafields in bulk.
Arguments
Specifies the condition by which metaobjects are deleted. Exactly one field of input is required.
Was this section helpful?
MetaobjectBulkDeletePayload returns
The asynchronous job that deletes the metaobjects.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: metaobjectBulkDelete
Query Reference for MUTATION: metaobjectBulkDelete
"mutation metaobjectBulkDelete($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n # Job fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: metaobjectBulkDelete
"{\n \"where\": {\n \"ids\": [\n \"gid://shopify/<objectName>/10079785100\"\n ],\n \"type\": \"<your-type>\"\n }\n}"
Schema Reference for MUTATION: metaobjectBulkDelete
"input MetaobjectBulkDeleteWhereCondition {\n ids: [ID!]\n type: String\n}\n"
Display Examples for MUTATION: metaobjectBulkDelete
[ { "example": { "type_name": "metaobjectbulkdelete", "title": "Delete metaobjects and their associated fields in bulk by IDs", "description": "To delete metaobjects and their associated metafields in bulk, use the `metaobjectBulkDelete` mutation.\nNote that this operation happens asynchronously, so the mutation will return immediately with a\n`job` object. You can use the `job` object to check the status of the operation.\nThe following example deletes 2 \"Lookbook\" metaobjects and their metafields using the IDs of the\nmetaobjects to delete.\n", "query_string": "mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n}", "variables": { "where": { "ids": [ "gid://shopify/Metaobject/515107504", "gid://shopify/Metaobject/129678104" ] } }, "response": { "data": { "metaobjectBulkDelete": { "job": { "id": "gid://shopify/Job/4d5319b7-71de-482e-b3c5-d11321c9ffca", "done": false } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/content/metaobjects/test/unit/graph_api/admin/mutations/metaobject_bulk_delete_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) { metaobjectBulkDelete(where: $where) { job { id done } } }\",\n \"variables\": {\n \"where\": {\n \"ids\": [\n \"gid://shopify/Metaobject/515107504\",\n \"gid://shopify/Metaobject/129678104\"\n ]\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }`,\n {\n variables: {\n \"where\": {\n \"ids\": [\n \"gid://shopify/Metaobject/515107504\",\n \"gid://shopify/Metaobject/129678104\"\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }\nQUERY\n\nvariables = {\n \"where\": {\n \"ids\": [\"gid://shopify/Metaobject/515107504\", \"gid://shopify/Metaobject/129678104\"]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }`,\n \"variables\": {\n \"where\": {\n \"ids\": [\n \"gid://shopify/Metaobject/515107504\",\n \"gid://shopify/Metaobject/129678104\"\n ]\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }\nQUERY;\n\n$variables = [\n \"where\" => [\n \"ids\" => [\"gid://shopify/Metaobject/515107504\", \"gid://shopify/Metaobject/129678104\"],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "where", "description": "Specifies the condition by which metaobjects are deleted.\nExactly one field of input is required.", "type": { "kind": "INPUT_OBJECT", "name": "MetaobjectBulkDeleteWhereCondition", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "MetaobjectBulkDeleteWhereCondition!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "where", "argValue": " {\"ids\":[\"gid://shopify/Metaobject/515107504\",\"gid://shopify/Metaobject/129678104\"]}", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "metaobjectbulkdelete", "title": "Delete metaobjects and their associated fields in bulk by type", "description": "Along with using ids to delete metaobjects, you can also delete metaobjects by type. Note that you must\nuse either `ids` or `type` but not both as they are mutually exclusive.\nThe following example deletes all the \"LookBook\" metaobjects by using the \"lookbook\" `type` argument.\n", "query_string": "mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n}", "variables": { "where": { "type": "lookbook" } }, "response": { "data": { "metaobjectBulkDelete": { "job": { "id": "gid://shopify/Job/e439ccf6-01c1-49df-9411-985def30b4f8", "done": false } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/content/metaobjects/test/unit/graph_api/admin/mutations/metaobject_bulk_delete_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) { metaobjectBulkDelete(where: $where) { job { id done } } }\",\n \"variables\": {\n \"where\": {\n \"type\": \"lookbook\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }`,\n {\n variables: {\n \"where\": {\n \"type\": \"lookbook\"\n }\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }\nQUERY\n\nvariables = {\n \"where\": {\n \"type\": \"lookbook\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }`,\n \"variables\": {\n \"where\": {\n \"type\": \"lookbook\"\n }\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation DeleteMetaobjects($where: MetaobjectBulkDeleteWhereCondition!) {\n metaobjectBulkDelete(where: $where) {\n job {\n id\n done\n }\n }\n }\nQUERY;\n\n$variables = [\n \"where\" => [\n \"type\" => \"lookbook\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "where", "description": "Specifies the condition by which metaobjects are deleted.\nExactly one field of input is required.", "type": { "kind": "INPUT_OBJECT", "name": "MetaobjectBulkDeleteWhereCondition", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "MetaobjectBulkDeleteWhereCondition!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "where", "argValue": " {\"type\":\"lookbook\"}", "typeKind": "MUTATION" } ] } ]