{"id":374890,"date":"2023-03-31T06:47:02","date_gmt":"2023-03-31T06:47:02","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=374890"},"modified":"2025-12-16T13:27:21","modified_gmt":"2025-12-16T13:27:21","slug":"steps-to-create-graphql-query","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/","title":{"rendered":"Steps to Create GraphQL Query"},"content":{"rendered":"\n<p>Below are the Steps that you can use to create a module as well as GraphQL query in Magento and use it in place of any REST APIs.<\/p>\n\n\n\n<p>Create a registration file in the folder in the path below.<\/p>\n\n\n\n<p><strong>Step 1 :-<\/strong>&nbsp;Create&nbsp;a <strong><code>registration.php<\/code><\/strong>&nbsp;file<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\n\\Magento\\Framework\\Component\\ComponentRegistrar::register(\n    \\Magento\\Framework\\Component\\ComponentRegistrar::MODULE,\n    &#039;Webkul_GraphQlCustom&#039;,\n    __DIR__\n);<\/pre>\n\n\n\n<p>Create a module.xml file in the path below.<\/p>\n\n\n\n<p><strong>Step 2 :-<\/strong>&nbsp;Create&nbsp;a <strong><code>etc\/module.xml<\/code><\/strong>&nbsp;file<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&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_GraphQlCustom&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<p>Create a <strong>schema.graphqls<\/strong> file in the path below. This file is used for adding the query schema and mutation schema, and its path.<\/p>\n\n\n\n<p>This file contains all the things which are related to the resolver class, as well as a description of the query.<\/p>\n\n\n\n<p><strong>Step 3 :-<\/strong>&nbsp;GraphQL queries are declared under the folder&nbsp;<strong><code>etc\/schema.graphqls<\/code><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">type Query {\n    testcustomer( email: String @doc(description: &quot;email of the customer&quot;)): Testcustomer @resolver(class:&quot;Webkul\\\\GraphQlCustom\\\\Model\\\\Resolver\\\\Customer&quot;) @doc(description:&quot;The test customer query returns information about a customer&quot;)\n}\ntype Testcustomer @doc(description: &quot;Testcustomer defines the customer name and other details&quot;) {\n    entity_id: Int\n    firstname: String\n    lastname: String\n    email: String\n    created_in: String\n    created_at: String\n}<\/pre>\n\n\n\n<p>Explanation of GraphQL:-<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>type Query &gt; declares Query operations of our module.<\/li>\n\n\n\n<li>testcustomer &gt; name of our query.<\/li>\n\n\n\n<li>email: String &gt; input name (email) and type (string).<\/li>\n\n\n\n<li>Test customer &gt; defines the identity of the query, including resolver (@resolver) class, document (@doc), is the result cacheable (@cache), etc.<\/li>\n\n\n\n<li>type Test customer &gt; define the result object of the query, including their name and type.<\/li>\n<\/ul>\n\n\n\n<p>Below is the file for the model resolver class.<\/p>\n\n\n\n<p>You can give any name to this file according to your needs.<\/p>\n\n\n\n<p><strong>Setp 4 :-<\/strong>&nbsp;Create a resolver class&nbsp;<strong><code>Model\/Resolver\/Customer.php<\/code><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nnamespace Webkul\\GraphQlCustom\\Model\\Resolver;\n\nuse Magento\\Authorization\\Model\\UserContextInterface;\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\\GraphQlAuthorizationException;\nuse Magento\\Framework\\GraphQl\\Exception\\GraphQlNoSuchEntityException;\nuse Magento\\Framework\\GraphQl\\Query\\Resolver\\ContextInterface;\nuse Magento\\Framework\\GraphQl\\Query\\Resolver\\Value;\nuse Magento\\Framework\\GraphQl\\Query\\Resolver\\ValueFactory;\nuse Magento\\Framework\\GraphQl\\Query\\ResolverInterface;\nuse Magento\\Customer\\Model\\CustomerFactory;\nuse Magento\\Customer\\Api\\CustomerRepositoryInterface;\nuse Magento\\Customer\\Api\\Data\\CustomerInterface;\nuse Magento\\Framework\\Webapi\\ServiceOutputProcessor;\nuse Magento\\Framework\\Api\\ExtensibleDataObjectConverter;\n\n\/**\n * Customers field resolver, used for GraphQL request processing.\n *\/\n\nclass Customer implements ResolverInterface\n{\n    \/**\n     * @var ValueFactory\n     *\/\n    private $valueFactory;\n\n    \/**\n     * @var CustomerFactory\n     *\/\n    private $customerFactory;\n\n    \/**\n     * @var ServiceOutputProcessor\n     *\/\n    private $serviceOutputProcessor;\n\n    \/**\n     * @var ExtensibleDataObjectConverter\n     *\/\n    private $dataObjectConverter;\n\n    \/**\n     * @var \\Psr\\Log\\LoggerInterface\n     *\/\n    private $logger;\n\n    \/**\n     * @var CustomerRepositoryInterface\n     *\/\n    private $customerRepository;\n\n    \/**\n     * Constructor\n     *\n     * @param ValueFactory $valueFactory\n     * @param CustomerFactory $customerFactory\n     * @param ServiceOutputProcessor $serviceOutputProcessor\n     * @param ExtensibleDataObjectConverter $dataObjectConverter\n     * @param CustomerRepositoryInterface $customerRepository\n     * @param \\Psr\\Log\\LoggerInterface $logger\n     *\/\n    public function __construct(\n        ValueFactory $valueFactory,\n        CustomerFactory $customerFactory,\n        ServiceOutputProcessor $serviceOutputProcessor,\n        ExtensibleDataObjectConverter $dataObjectConverter,\n        CustomerRepositoryInterface $customerRepository,\n        \\Psr\\Log\\LoggerInterface $logger\n    ) {\n        $this-&gt;valueFactory = $valueFactory;\n        $this-&gt;customerFactory = $customerFactory;\n        $this-&gt;serviceOutputProcessor = $serviceOutputProcessor;\n        $this-&gt;dataObjectConverter = $dataObjectConverter;\n        $this-&gt;customerRepository = $customerRepository;\n        $this-&gt;logger = $logger;\n    }\n\n    \/**\n     * Resolver Method\n     *\n     * @param Field $field\n     * @param ContextInterface $context\n     * @param ResolveInfo $info\n     * @param array|null $value\n     * @param array|null $args\n     * @return array\n     *\/\n    public function resolve(Field $field, $context, ResolveInfo $info, ?array $value = null, ?array $args = null)\n    {\n\n        if (!isset($args&#091;&#039;email&#039;])) {\n            throw new GraphQlAuthorizationException(\n                __(\n                    &#039;email for customer should be specified&#039;,\n                    &#091;\\Magento\\Customer\\Model\\Customer::ENTITY]\n                )\n            );\n        }\n        try {\n            $data = $this-&gt;getCustomerData($args&#091;&#039;email&#039;]);\n            $result = function () use ($data) {\n                return !empty($data) ? $data : &#091;];\n            };\n            return $this-&gt;valueFactory-&gt;create($result);\n        } catch (NoSuchEntityException $exception) {\n            throw new GraphQlNoSuchEntityException(__($exception-&gt;getMessage()));\n        } catch (LocalizedException $exception) {\n            throw new GraphQlNoSuchEntityException(__($exception-&gt;getMessage()));\n        }\n    }\n\n    \/**\n     * Get Customer Data\n     *\n     * @param string $customerEmail\n     * @return array\n     * @throws NoSuchEntityException|LocalizedException\n     *\/\n    private function getCustomerData($customerEmail) : array\n    {\n        try {\n            $customerData = &#091;];\n            $customerColl = $this-&gt;customerFactory-&gt;create()-&gt;getCollection()-&gt;addFieldToFilter(&#039;email&#039;, &#091;&#039;eq&#039;=&gt;$customerEmail]);\n            foreach ($customerColl as $customer) {\n                array_push($customerData, $customer-&gt;getData());\n            }\n            return isset($customerData&#091;0])?$customerData&#091;0]:&#091;];\n        } catch (NoSuchEntityException $e) {\n            return &#091;];\n        } catch (LocalizedException $e) {\n            throw new NoSuchEntityException(__($e-&gt;getMessage()));\n        }\n    }\n}<\/pre>\n\n\n\n<p>Explanation:-<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Resolver class must implement Magento\\Framework\\GraphQl\\Query\\ResolverInterface<\/li>\n\n\n\n<li>&#8220;resolve&#8221; is the main method of this class, with $args as the query\u2019s input<\/li>\n<\/ul>\n\n\n\n<p><strong>Setp 5 :-<\/strong>&nbsp;Final step, check the output by running the below query<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{\n    testcustomer(email: &quot;test@webkul.in&quot;) {\n        entity_id\n        firstname\n        lastname\n        email\n        created_in\n        created_at\n    }\n}<\/pre>\n\n\n\n<p>Run the above GraphQL query in Postman by selecting GraphQL in the body and type as POST.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"521\" height=\"357\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png\" alt=\"Selection_057\" class=\"wp-image-374915\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png 521w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057-300x206.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057-250x171.png 250w\" sizes=\"(max-width: 521px) 100vw, 521px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Postman view<\/figcaption><\/figure>\n\n\n\n<p>Learn more from this link : <a href=\"https:\/\/developer.adobe.com\/commerce\/webapi\/graphql\/\">https:\/\/developer.adobe.com\/commerce\/webapi\/graphql\/<\/a><\/p>\n\n\n\n<p>Check for other blogs as well:<a href=\"https:\/\/developer.adobe.com\/commerce\/webapi\/graphql\/usage\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a> <a href=\"https:\/\/webkul.com\/blog\/graphql-mutation-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/webkul.com\/blog\/graphql-mutation-2\/<\/a><\/p>\n\n\n\n<p>If you need any technical support, please get in touch with us at\u00a0<a href=\"mailto:support@webkul.com\">support@webkul.com<\/a><\/p>\n\n\n\n<p>Additionally, unlock powerful enhancements for your Magento 2 store by exploring our <a href=\"https:\/\/store.webkul.com\/Magento-2.html\">Magento 2 plugins.<\/a><\/p>\n\n\n\n<p>Turn your ideas into powerful features with expert <a href=\"https:\/\/webkul.com\/hire-magento-developers\/\">Magento 2 developers.<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Below are the Steps that you can use to create a module as well as GraphQL query in Magento and use it in place of any REST APIs. Create a registration file in the folder in the path below. Step 1 :-&nbsp;Create&nbsp;a registration.php&nbsp;file Create a module.xml file in the path below. Step 2 :-&nbsp;Create&nbsp;a etc\/module.xml&nbsp;file <a href=\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":605,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2056,2070],"class_list":["post-374890","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-magento","tag-magento2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Steps to Create graphql query<\/title>\n<meta name=\"description\" content=\"GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015. Magento implements GraphQL to provide an alternative to REST and SOAP web APIs for frontend development.Use a GraphQL IDE such as GraphiQL or a browser extension to run the code samples and tutorials. Steps to Create graphql query . If you install a browser extension, make sure it has the ability to set request headers. On Google .\" \/>\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\/steps-to-create-graphql-query\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Steps to Create graphql query\" \/>\n<meta property=\"og:description\" content=\"GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015. Magento implements GraphQL to provide an alternative to REST and SOAP web APIs for frontend development.Use a GraphQL IDE such as GraphiQL or a browser extension to run the code samples and tutorials. Steps to Create graphql query . If you install a browser extension, make sure it has the ability to set request headers. On Google .\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/\" \/>\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=\"2023-03-31T06:47:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-16T13:27:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png\" \/>\n<meta name=\"author\" content=\"Atif Yaqoob\" \/>\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=\"Atif Yaqoob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/\"},\"author\":{\"name\":\"Atif Yaqoob\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/2273bf3f70f0107d46749e115bf818fa\"},\"headline\":\"Steps to Create GraphQL Query\",\"datePublished\":\"2023-03-31T06:47:02+00:00\",\"dateModified\":\"2025-12-16T13:27:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/\"},\"wordCount\":339,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png\",\"keywords\":[\"magento\",\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/\",\"url\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/\",\"name\":\"Steps to Create graphql query\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png\",\"datePublished\":\"2023-03-31T06:47:02+00:00\",\"dateModified\":\"2025-12-16T13:27:21+00:00\",\"description\":\"GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015. Magento implements GraphQL to provide an alternative to REST and SOAP web APIs for frontend development.Use a GraphQL IDE such as GraphiQL or a browser extension to run the code samples and tutorials. Steps to Create graphql query . If you install a browser extension, make sure it has the ability to set request headers. On Google .\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png\",\"width\":521,\"height\":357,\"caption\":\"Selection_057\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Steps to Create GraphQL Query\"}]},{\"@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\/2273bf3f70f0107d46749e115bf818fa\",\"name\":\"Atif Yaqoob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5ed5b0a496b935107cbfc11af454d90dc3e6458b661598c2027cfcfbbf88a915?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\/5ed5b0a496b935107cbfc11af454d90dc3e6458b661598c2027cfcfbbf88a915?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Atif Yaqoob\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/atif-yakoob869\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Steps to Create graphql query","description":"GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015. Magento implements GraphQL to provide an alternative to REST and SOAP web APIs for frontend development.Use a GraphQL IDE such as GraphiQL or a browser extension to run the code samples and tutorials. Steps to Create graphql query . If you install a browser extension, make sure it has the ability to set request headers. On Google .","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\/steps-to-create-graphql-query\/","og_locale":"en_US","og_type":"article","og_title":"Steps to Create graphql query","og_description":"GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015. Magento implements GraphQL to provide an alternative to REST and SOAP web APIs for frontend development.Use a GraphQL IDE such as GraphiQL or a browser extension to run the code samples and tutorials. Steps to Create graphql query . If you install a browser extension, make sure it has the ability to set request headers. On Google .","og_url":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-03-31T06:47:02+00:00","article_modified_time":"2025-12-16T13:27:21+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png","type":"","width":"","height":""}],"author":"Atif Yaqoob","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Atif Yaqoob","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/"},"author":{"name":"Atif Yaqoob","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/2273bf3f70f0107d46749e115bf818fa"},"headline":"Steps to Create GraphQL Query","datePublished":"2023-03-31T06:47:02+00:00","dateModified":"2025-12-16T13:27:21+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/"},"wordCount":339,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png","keywords":["magento","Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/","url":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/","name":"Steps to Create graphql query","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png","datePublished":"2023-03-31T06:47:02+00:00","dateModified":"2025-12-16T13:27:21+00:00","description":"GraphQL is a data query language developed internally by Facebook in 2012 before being publicly released in 2015. Magento implements GraphQL to provide an alternative to REST and SOAP web APIs for frontend development.Use a GraphQL IDE such as GraphiQL or a browser extension to run the code samples and tutorials. Steps to Create graphql query . If you install a browser extension, make sure it has the ability to set request headers. On Google .","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/03\/Selection_057.png","width":521,"height":357,"caption":"Selection_057"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/steps-to-create-graphql-query\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Steps to Create GraphQL Query"}]},{"@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\/2273bf3f70f0107d46749e115bf818fa","name":"Atif Yaqoob","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5ed5b0a496b935107cbfc11af454d90dc3e6458b661598c2027cfcfbbf88a915?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\/5ed5b0a496b935107cbfc11af454d90dc3e6458b661598c2027cfcfbbf88a915?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Atif Yaqoob"},"url":"https:\/\/webkul.com\/blog\/author\/atif-yakoob869\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/374890","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\/605"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=374890"}],"version-history":[{"count":46,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/374890\/revisions"}],"predecessor-version":[{"id":517561,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/374890\/revisions\/517561"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=374890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=374890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=374890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}