GraphQL
Documentation
Magento Dev Docs — GraphQL
What is GraphQL and why Magento uses it.
Example schemas
These GraphQL schemas are good examples of structure and types:
- Magento_CatalogGraphQl
- Magento_CustomerGraphQl
- Magento_CmsGraphQl
- Magento_EavGraphQl
- Magento_StoreGraphQl
Building a GraphQL module
https://webkul.com/blog/graphql-implementation-in-magneto2/
After changing a schema.graphqls
remember to run php bin/magento cache:clean
. Schemas are cached by Magento.
Examples queries for GraphQL Playground
These queries work with the Venia sample data for PWA Studio:
getCategoryList
{
"id": 2
}
getCmsBlocks
{
"identifiers": "sample"
}
getNavigationMenu
{
"id": 2
}
getProductDetails
{
"urlKey": "valeria-two-layer-tank",
"onServer": true
}
productSearch
{
"inputText": "shirt"
}
urlResolver
{
"urlKey": "valeria-two-layer-tank.html"
}