Overview
The GraphQL API provides a flexible alternative to REST endpoints for querying product listings, product details, banners, and navigation menus. The endpoint supports both GET and POST requests with query and variable parameters.Endpoint
CMS GraphQL Endpoint
Content Types
The GraphQL endpoint accepts three content types:application/json- Standard JSON requests with query and variablesapplication/graphql- Raw GraphQL query stringsapplication/x-www-form-urlencoded- Form-encoded requests
Schema Overview
The GraphQL schema is built with Graphene and provides two main query types:Main Schema
- product - Fetch individual product details
- listing - Query product listings with filtering and pagination
CMS Schema
- productdetail - Fetch product detail page data
- bannerurl - Query banner configurations
- desktopnavmenu - Desktop navigation menu structure
- mobilenavmenu - Mobile navigation menu structure
Query Examples
Fetch Product Listing
Fetch Single Product
Fetch Product Detail Page (CMS)
Filter Options
Thelisting query supports comprehensive filtering:
Sort Options
Available sort values:DEFAULT- Default sortingPRICE_LOW_TO_HIGH- Price ascendingPRICE_HIGH_TO_LOW- Price descendingDISCOUNT_HIGH_TO_LOW- Discount descendingNEWEST_FIRST- Recently added products
Pagination
Page number for pagination
Number of products per page
Exclusive Pricing
The GraphQL resolver automatically detects exclusive users and applies exclusive pricing:is_exclusive_user: true in your request body to enable exclusive pricing.
Caching
By default, GraphQL queries use cached results for improved performance. To bypass cache:Error Handling
The GraphQL endpoint returns errors in the standard GraphQL format:Must provide query string- No query provided in requestVariables are invalid JSON- Malformed variables parameterPOST body sent invalid JSON- Invalid request body
Implementation Details
The GraphQL implementation uses:- Graphene - Python GraphQL library
- MongoDB - Product data storage (see models/gql/schema.py:26)
- Redis - Query result caching
- Beaker - Cache region management
The GraphQL endpoint integrates with the cart middleware to apply exclusive pricing wrappers automatically.
Related Resources
Search API
Learn about the Dgraph-based search functionality
Product Catalog
REST API endpoints for products and categories