Query
customers
Retrieves a paginated list of customers. Restricted to administrative users only.
Signature
query { customers(first: Int, after: String, search: String): CustomerConnection! }
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
first |
Int |
No | Number of items to return (max 50) |
after |
String |
No | Cursor for pagination - return items after this cursor |
search |
String |
No | Search term to filter customers by name or email |
Return Type
CustomerConnection!
Complexity: 3
Examples
Query
query ListCustomers($first: Int, $after: String, $search: String) {
customers(first: $first, after: $after, search: $search) {
edges {
node {
id
email
firstName
lastName
createdAt
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
totalCount
}
}
Variables
{
"first": 10,
"search": "john"
}
Response
{
"data": {
"customers": {
"edges": [
{
"node": {
"id": "cust_xyz789",
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"createdAt": "2023-06-15T09:00:00Z"
},
"cursor": "Y3Vyc29yOjE="
},
{
"node": {
"id": "cust_abc456",
"email": "[email protected]",
"firstName": "Johnny",
"lastName": "Smith",
"createdAt": "2023-08-20T14:30:00Z"
},
"cursor": "Y3Vyc29yOjI="
}
],
"pageInfo": {
"hasNextPage": true,
"endCursor": "Y3Vyc29yOjI="
},
"totalCount": 45
}
}
}