Magento2 GraphQL Introduction. Magento2 GraphQL Examples

Share:

Magento2 GraphQL Introduction

or

Magento2 GraphQL  Examples


It is Data Query Language developed by Facebook in 2012

We can use an alternative to REST API and SOAP Web API

In Magento 2.3.4 we face some issue but next version 2.3.5 magento team will fix this issue.

Advantage of GraphQL

1. APP user not depand on API Developer. He can easily create use cases and proceed his work.

2. Provide "GraphQL caching". so that our execution time we decrease.

         


GraphQL Support GET and POST methods

  1. GET Method is used for SELECT Query
        example :- Get Product list by SKU 

  2. POST Method is used for CRUD Operation.
example :- Create Customer Account 


POST Method

Request 

{
  products(
    filter: { sku: { eq: "24-WB01" } }
  ) {
    items {
      name
      sku
    }
  }
}


Response

{
  "data": {
    "products": {
      "items": [
        {
          "name": "Voyage Yoga Bag",
          "sku": "24-WB01"
        }
      ]
    }
  }
}

We can send same Request Using GET method by just encode the query.


http:///graphql?query=%7Bproducts(filter%3A%7Bsku%3A%7Beq%3A%2224-WB01%22%7D%7D)%7Bitems%7Bname%20sku%7D%7D%7D



We can view video on Youtube also


We can access GraphQL by Two ways 

1. POSTMEN  (download latest version of postmen)

2. ChromeiQL extension of Google 

                                 

1 comment:

  1. Thanks for sharing the valuable information here. Keep sharing more informative articles.


    https://www.technokryon.com/android-app-development
    https://www.technokryon.com/react-native-app
    https://www.technokryon.com/magento-development-company

    ReplyDelete