{"id":353863,"date":"2022-09-29T13:55:00","date_gmt":"2022-09-29T13:55:00","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=353863"},"modified":"2022-09-30T04:37:27","modified_gmt":"2022-09-30T04:37:27","slug":"graphql-mutation-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/","title":{"rendered":"GraphQL Mutation"},"content":{"rendered":"\n<p>In this blog, we will discuss the GraphQl Mutation<\/p>\n\n\n\n<p><strong>What is Mutation in GraphQL<\/strong>:<\/p>\n\n\n\n<p>It is an operation of GraphQL by which you can insert new data or modify the existing data.<\/p>\n\n\n\n<p>This Blog will familiarize you with the GraphQl mutation<\/p>\n\n\n\n<p>There are some Easy steps you can follow to create a graphQL Mutation<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>create this file to register your module<\/li><\/ul>\n\n\n\n<p>app\/code\/Webkul\/GraphQlMutation\/registration.php<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n* Webkul Software.\n*\n* @category  Webkul\n* @package   Webkul_GraphQlMutation\n* @author    Webkul\n* @license   https:\/\/store.webkul.com\/license.html\n*\/\n\\Magento\\Framework\\Component\\ComponentRegistrar::register(\n    \\Magento\\Framework\\Component\\ComponentRegistrar::MODULE,\n    &#039;Webkul_GraphQlMutation&#039;,\n    __DIR__\n);<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>To define the module name you have to create  app\/code\/Webkul\/GraphQlMutation\/etc\/module.xml<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;!--\n\/**\n* Webkul Software.\n*\n* @category  Webkul\n* @package   Webkul_GraphQlMutation\n* @author    Webkul\n* @license   https:\/\/store.webkul.com\/license.html\n*\/\n--&gt;\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:Module\/etc\/module.xsd&quot;&gt;\n    &lt;module name=&quot;Webkul_GraphQlMutation&quot; &gt;\n        &lt;sequence&gt;\n            &lt;module name=&quot;Magento_Customer&quot;\/&gt;\n            &lt;module name=&quot;Magento_Authorization&quot;\/&gt;\n            &lt;module name=&quot;Magento_GraphQl&quot;\/&gt;\n        &lt;\/sequence&gt;\n    &lt;\/module&gt;\n&lt;\/config&gt;<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>First, we have to define the Schema of Mutation. The schema is a container of your type hierarchy, which accepts root types in a constructor and provides methods for receiving information about your types to internal GrahpQL tools. The schema consists of two root types:<\/li><\/ul>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Query<\/strong>: type is a surface of your read API. You can refer to our GraphQl query Blog <a href=\"https:\/\/webkul.com\/blog\/graphql-implementation-in-magento2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Graphql query<\/a><\/li><li><strong>Mutation<\/strong>:  type exposes write API by declaring all possible mutations in your app<\/li><\/ol>\n\n\n\n<p>create schema.graphqls at this path app\/code\/Webkul\/GraphQlMutation\/etc\/<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">#GraphQl Schema for Mutation\n\ntype Mutation {\neditCustomerName (customerId: Int! @doc(description: &quot;Customer Id to load the customer Data&quot;),\nfirstName: String! @doc(description: &quot;First Name as a input&quot;),\nlastName: String! @doc(description: &quot;Last Name as a input&quot;)):\nEditCustomerName @resolver(class: &quot;Webkul\\\\TestGraphQl\\\\Model\\\\Resolver\\\\EditCustomerName&quot;) @doc(description: &quot;The EditCustomer name Mutation will edit the name of the customer&quot;)\n}\ntype EditCustomerName @doc(description: &quot;Testcustomer defines the customer name and other details&quot;) {\n    firstName: String\n    lastName: String\n}<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Create Resolver Model class which is defined in the schema. In this resolve method, we will edit the customer name.<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_GraphQlMutation\n * @author    Webkul\n * @copyright Copyright (c) Webkul Software Private Limited  (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n\ndeclare(strict_types=1);\n\nnamespace Webkul\\GraphQlMutation\\Model\\Resolver;\n\nuse Magento\\Framework\\GraphQl\\Schema\\Type\\ResolveInfo;\nuse Magento\\Framework\\Exception\\NoSuchEntityException;\nuse Magento\\Framework\\Exception\\LocalizedException;\nuse Magento\\Framework\\GraphQl\\Config\\Element\\Field;\nuse Magento\\Framework\\GraphQl\\Exception\\GraphQlNoSuchEntityException;\nuse Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\nuse Magento\\GraphQl\\Model\\Query\\ContextInterface;\nuse Magento\\Framework\\GraphQl\\Exception\\GraphQlAuthorizationException;\nuse Magento\\Customer\\Model\\ResourceModel\\Customer\\CollectionFactory as CustomerCollection;\nuse Magento\\Customer\\Model\\CustomerFactory;\n\nclass EditCustomerName implements ResolverInterface\n{\n    \n\n    \/**\n     * @inheritdoc\n     *\/\n    public function __construct(\n        CustomerFactory $customerModel,\n        CustomerCollection $customerCollection\n    ) {\n        $this-&gt;customerModel = $customerModel;\n        $this-&gt;customerCollection = $customerCollection;\n    }\n\n    \/**\n     * @inheritdoc\n     *\/\n    public function resolve(\n        Field $field,\n        $context,\n        ResolveInfo $info,\n        array $value = null,\n        array $args = null\n    ) {\n        try {\n            \/** @var ContextInterface $context *\/\n            if (false === $context-&gt;getExtensionAttributes()-&gt;getIsCustomer()) {\n                throw new GraphQlAuthorizationException(__(&#039;The current customer isn\\&#039;t authorized.&#039;));\n            }\n            $params = $args;\n            $customerId = $params&#091;&#039;customerId&#039;];\n            $first_name = $params&#091;&#039;firstName&#039;];\n            $last_name = $params&#091;&#039;lastName&#039;];\n            $collection = $this-&gt;customerCollection-&gt;create()\n            -&gt;addFieldToFilter(&#039;entity_id&#039;, $customerId);\n            if ($collection-&gt;getSize() &gt; 0) {\n                $model = $this-&gt;customerModel-&gt;create();\n                $model-&gt;load($customerId);\n                $model-&gt;setFirstname($first_name);\n                $model-&gt;setLastname($last_name);\n                $model-&gt;save();\n                return &#091;\n                    &#039;firstName&#039; =&gt; $model-&gt;getFirstname(),\n                    &#039;lastName&#039; =&gt; $model-&gt;getLastname()\n                ];\n            } else {\n                throw new GraphQlNoSuchEntityException(\n                   __(&#039;Customer with customer id %1 not found&#039;,                                          $customerId));\n            }\n        } catch (NoSuchEntityException $exception) {\n            throw new GraphQlNoSuchEntityException(__($exception-&gt;getMessage()));\n        } catch (LocalizedException $e) {\n            throw new GraphQlNoSuchEntityException(__($e-&gt;getMessage()));\n        }\n    }\n}<\/pre>\n\n\n\n<p>To Test The mutation first, you have to install the IDE <a href=\"https:\/\/altair.sirmuel.design\/\">Altair<\/a> and set the Endpoint <strong>&lt;your_base_url_to_the_pub&gt;\/graphql<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1034\" height=\"461\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png\" alt=\"Screenshot-from-2022-09-29-16-34-43-2\" class=\"wp-image-353867\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png 1034w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2-300x134.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2-250x111.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2-768x342.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2-604x270.png 604w\" sizes=\"(max-width: 1034px) 100vw, 1034px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Please run the following command to install this module.<\/p>\n\n\n\n<p>1 \u2013 php bin\/magento setup:upgrade<\/p>\n\n\n\n<p>2 \u2013 php bin\/magento cache:flush<\/p>\n\n\n\n<p><strong>This will check the authentication of the customer, if you have the credentials of the customer then only you have the authorization to edit the customer<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/** @var ContextInterface $context *\/\nif (false === $context-&gt;getExtensionAttributes()-&gt;getIsCustomer()) {\n   throw new GraphQlAuthorizationException(\n       __(&#039;The current customer isn\\&#039;t authorized.&#039;\n   ));\n}<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Generate the customer token by graphQl mutation<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\">mutation {\n  generateCustomerToken(\n   email: &quot;&lt;Cutomer_Email&gt;&quot;, password: &quot;&lt;Customer_Password&gt;&quot;) {\n    token\n  }\n}<\/pre>\n\n\n\n<p><strong>Response You will get<\/strong>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{\n  &quot;data&quot;: {\n    &quot;generateCustomerToken&quot;: {\n      &quot;token&quot;: &quot;Generated Token&quot;\n    }\n  }\n}<\/pre>\n\n\n\n<p>Put that customer token in the header of the GraphQL IDE <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-13-1.png\" alt=\"Screenshot-from-2022-09-29-13-15-13-1\" class=\"wp-image-353869\" width=\"819\" height=\"343\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-13-1.png 533w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-13-1-300x126.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-13-1-250x105.png 250w\" sizes=\"(max-width: 819px) 100vw, 819px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>You will get this pop-up set the token here<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-47-2.png\" alt=\"Screenshot-from-2022-09-29-13-15-47-2\" class=\"wp-image-353870\" width=\"819\" height=\"470\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-47-2.png 535w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-47-2-300x172.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-13-15-47-2-250x143.png 250w\" sizes=\"(max-width: 819px) 100vw, 819px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>After Setting up these all things you will have to perform the mutation,<\/p>\n\n\n\n<p><strong>Before Performing the mutation<\/strong> <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-09-34-1-1200x155.png\" alt=\"Screenshot-from-2022-09-29-15-09-34-1\" class=\"wp-image-353871\" width=\"818\" height=\"105\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-09-34-1-1200x155.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-09-34-1-300x39.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-09-34-1-250x32.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-09-34-1-768x99.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-09-34-1.png 1364w\" sizes=\"(max-width: 818px) 100vw, 818px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Mutation Guide<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"981\" height=\"260\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-12-45-1.png\" alt=\"Screenshot-from-2022-09-29-15-12-45-1\" class=\"wp-image-353872\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-12-45-1.png 981w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-12-45-1-300x80.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-12-45-1-250x66.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-12-45-1-768x204.png 768w\" sizes=\"(max-width: 981px) 100vw, 981px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>After Performing Mutation<\/strong><\/p>\n\n\n\n<p>The customer name has been changed<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"155\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-13-58-1-1200x155.png\" alt=\"Screenshot-from-2022-09-29-15-13-58-1\" class=\"wp-image-353873\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-13-58-1-1200x155.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-13-58-1-300x39.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-13-58-1-250x32.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-13-58-1-768x99.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-15-13-58-1.png 1361w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Meanwhile Please try the above example and If you have any Query then please ask in the comment section below.<\/p>\n\n\n\n<p>Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we will discuss the GraphQl Mutation What is Mutation in GraphQL: It is an operation of GraphQL by which you can insert new data or modify the existing data. This Blog will familiarize you with the GraphQl mutation There are some Easy steps you can follow to create a graphQL Mutation create <a href=\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":477,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-353863","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>GraphQL Mutation - Webkul Blog<\/title>\n<meta name=\"description\" content=\"In this blog, we will discuss GraphQl Mutation and create a module with graphql, It is an operation of GraphQL by which you can insert new data or modify the existing data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GraphQL Mutation - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"In this blog, we will discuss GraphQl Mutation and create a module with graphql, It is an operation of GraphQL by which you can insert new data or modify the existing data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-29T13:55:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-30T04:37:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png\" \/>\n<meta name=\"author\" content=\"Munassir Alam\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Munassir Alam\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\"},\"author\":{\"name\":\"Munassir Alam\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/013ee40caab80af25e1d0fbf5abd4c29\"},\"headline\":\"GraphQL Mutation\",\"datePublished\":\"2022-09-29T13:55:00+00:00\",\"dateModified\":\"2022-09-30T04:37:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\"},\"wordCount\":344,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\",\"name\":\"GraphQL Mutation - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png\",\"datePublished\":\"2022-09-29T13:55:00+00:00\",\"dateModified\":\"2022-09-30T04:37:27+00:00\",\"description\":\"In this blog, we will discuss GraphQl Mutation and create a module with graphql, It is an operation of GraphQL by which you can insert new data or modify the existing data.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png\",\"width\":1034,\"height\":461,\"caption\":\"Screenshot-from-2022-09-29-16-34-43-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GraphQL Mutation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/013ee40caab80af25e1d0fbf5abd4c29\",\"name\":\"Munassir Alam\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d3ee79d09c61b4c07a01a11900c614adf94a7913490a704e03f60d4e346df7a0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d3ee79d09c61b4c07a01a11900c614adf94a7913490a704e03f60d4e346df7a0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Munassir Alam\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/munassir-alam632\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GraphQL Mutation - Webkul Blog","description":"In this blog, we will discuss GraphQl Mutation and create a module with graphql, It is an operation of GraphQL by which you can insert new data or modify the existing data.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/","og_locale":"en_US","og_type":"article","og_title":"GraphQL Mutation - Webkul Blog","og_description":"In this blog, we will discuss GraphQl Mutation and create a module with graphql, It is an operation of GraphQL by which you can insert new data or modify the existing data.","og_url":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2022-09-29T13:55:00+00:00","article_modified_time":"2022-09-30T04:37:27+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png","type":"","width":"","height":""}],"author":"Munassir Alam","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Munassir Alam","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/"},"author":{"name":"Munassir Alam","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/013ee40caab80af25e1d0fbf5abd4c29"},"headline":"GraphQL Mutation","datePublished":"2022-09-29T13:55:00+00:00","dateModified":"2022-09-30T04:37:27+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/"},"wordCount":344,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/graphql-mutation-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/","url":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/","name":"GraphQL Mutation - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png","datePublished":"2022-09-29T13:55:00+00:00","dateModified":"2022-09-30T04:37:27+00:00","description":"In this blog, we will discuss GraphQl Mutation and create a module with graphql, It is an operation of GraphQL by which you can insert new data or modify the existing data.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/graphql-mutation-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/09\/Screenshot-from-2022-09-29-16-34-43-2.png","width":1034,"height":461,"caption":"Screenshot-from-2022-09-29-16-34-43-2"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/graphql-mutation-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"GraphQL Mutation"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/013ee40caab80af25e1d0fbf5abd4c29","name":"Munassir Alam","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d3ee79d09c61b4c07a01a11900c614adf94a7913490a704e03f60d4e346df7a0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d3ee79d09c61b4c07a01a11900c614adf94a7913490a704e03f60d4e346df7a0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Munassir Alam"},"url":"https:\/\/webkul.com\/blog\/author\/munassir-alam632\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/353863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/477"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=353863"}],"version-history":[{"count":4,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/353863\/revisions"}],"predecessor-version":[{"id":353946,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/353863\/revisions\/353946"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=353863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=353863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=353863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}