GraphQL API Test
Query the GraphQL endpoint at POST /api/test/graphql to extract product data, reviews, and categories using relay-style pagination.
Test Passing Criteria
Endpoint
Send a POST request with a JSON body containing a
query field.POST /api/test/graphql
Content-Type: application/json
{
"query": "{ products(first: 10) { edges { node { id name price } cursor } pageInfo { hasNextPage endCursor totalCount } } }"
}Example Queries
List Products (paginated)
Fetch the first 5 products with relay-style pagination
{
products(first: 5) {
edges {
node {
id
name
price
category
sku
rating
inStock
}
cursor
}
pageInfo {
hasNextPage
endCursor
totalCount
}
}
}Single Product with Reviews
Fetch a specific product by ID including its reviews
{
product(id: 1) {
id
name
description
price
originalPrice
category
brand
sku
rating
reviewCount
inStock
reviews {
edges {
node {
id
author
rating
title
content
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
}
}
}Categories
Fetch all available product categories
{
categories
}Interactive Explorer
GraphQL Explorer
Supported Queries
products(first, after, category)product(id)categories__schema