Query
products
Retrieves a paginated list of products with optional filtering. Supports Relay-style cursor-based pagination.
Signature
query { products(first: Int, after: String, filter: ProductFilter): ProductConnection! }
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
first |
Int |
No | Number of items to return (max 100) |
after |
String |
No | Cursor for pagination - return items after this cursor |
filter |
ProductFilter |
No | Optional filter criteria for products |
Return Type
ProductConnection!
Complexity: 3
Examples
Query
query ListProducts($first: Int, $after: String, $filter: ProductFilter) {
products(first: $first, after: $after, filter: $filter) {
edges {
node {
id
name
price
stockQuantity
}
cursor
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
totalCount
}
}
Variables
{
"first": 10,
"filter": {
"categoryId": "cat_electronics",
"inStock": true
}
}
Response
{
"data": {
"products": {
"edges": [
{
"node": {
"id": "prod_abc123",
"name": "Wireless Bluetooth Headphones",
"price": "149.99",
"stockQuantity": 250
},
"cursor": "Y3Vyc29yOjE="
},
{
"node": {
"id": "prod_def456",
"name": "USB-C Charging Cable",
"price": "19.99",
"stockQuantity": 500
},
"cursor": "Y3Vyc29yOjI="
}
],
"pageInfo": {
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "Y3Vyc29yOjE=",
"endCursor": "Y3Vyc29yOjI="
},
"totalCount": 156
}
}
}