What is GraphQl ?
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more.
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.
GraphQL included in Magento 2.3.0
Magento2 + GraphQL
With the lastest magento release 2.3 include the GraphQl
Lets have a look on the core magento code
We can see the code in magento core and schema defined in the file schema.graphqls.
Lets Check how to use ?
Step1 – Lets Install the extension to test graphql
Google addon – https://chrome.google.com/webstore/detail/chromeiql/fkkiamalmpiidkljmicmjfbieiclmeij
Step2 – add endpoint like – http://domain.com/index.php/graphql
Step3 – add parameter and run and it will output like screenshot.
Good practical use cases:
- Backend Magento -> Frontend App (iOS, Android)
- 3D Planner for a Living Room -> use Magento Checkout and Backend for the Products
Next – we will check the Custom module using Graphql in Magento 2