User Query
Note: The Teachify Admin API is currently under development and not yet available for public use. This documentation is provided for preview purposes only.
Overview
The Users API allows you to retrieve information about users in your school. You can list all users, get details for a specific user, and access related data.
Available Queries
users
Returns a paginated list of users for the school.
Parameters:
Parameter | Type | Description |
---|---|---|
filter | UserFilter | Filter criteria (see Filtering) |
page | Int | Page number for pagination |
perPage | Int | Number of items per page (default: 20, max: 50) |
limit | Int | Alternative to perPage |
Returns:
- UserPage object with:
nodes
: Array of User objectscurrentPage
: Current page numberhasNextPage
: Whether there are more pageshasPreviousPage
: Whether there are previous pagesnodesCount
: Total number of items in the current pagetotalPages
: Total number of pages
Example:
query { users( page: 1 perPage: 10 ) { nodes { id name email phoneNumber } currentPage hasNextPage totalPages }}
User Object
The User object contains the following fields based on the schema:
Field | Type | Description |
---|---|---|
id | ID! | Unique identifier (UUID) |
name | String! | Full name of the user |
email | String! | Email address of the user |
phoneNumber | String | Phone number of the user |
Detailed Query Structure
Below is a comprehensive view of fields available in the users query based on the schema:
query { users( filter: { name: { eq: "Smith" } } page: 1 perPage: 20 ) { # User metadata nodes { id # Unique identifier (ID!) name # Full name (String!) email # Email address (String!) phoneNumber # Phone number (String)
# subscriptions of user subscriptions( filter: { state: { eq: "active" } } ) { nodes { id planId state } }
# Pagination metadata currentPage # Current page number (Int!) hasNextPage # Whether there are more pages (Boolean!) hasPreviousPage # Whether there are previous pages (Boolean!) nodesCount # Number of items in current page (Int!) totalPages # Total number of pages (Int!) }}
Filtering
The users
query accepts a filter
parameter of type UserFilter
. This allows you to narrow down results based on various criteria.
Filter Field | Type | Description |
---|---|---|
name | StringOperator | Filter by user name |
email | StringOperator | Filter by user email |
StringOperator
The StringOperator
used in filters has these operations:
Operation | Description |
---|---|
eq | Equal to |
neq | Not equal to |
in | In a list of values |
nin | Not in a list of values |
like | Match text values against a pattern using wildcards (case-sensitive) |
Filter Examples
Find users with a specific name pattern:
query { users( filter: { name: { eq: "Smith" } } ) { nodes { id name email } }}
Find users with a specific email pattern:
query { users( filter: { } ) { nodes { id name email } }}
Subscriptions Fields
The User object can include subscription information through the subscriptions
field. This returns a paginated list of the user’s subscriptions.
Field | Type | Description |
---|---|---|
id | ID! | Unique identifier for the subscription |
planId | String! | Identifier of the subscription plan |
state | String! | Current state of the subscription |
createdAt | DateTime! | When the subscription was created |
StringOperator
The StringOperator
used in filters has these operations:
Operation | Description |
---|---|
eq | Equal to |
neq | Not equal to |
in | In a list of values |
nin | Not in a list of values |
like | Match text values against a pattern using wildcards (case-sensitive) |
Subscription Filter Parameters
Parameter | Type | Description |
---|---|---|
id | StringOperator | Filter by subscription ID |
planId | StringOperator | Filter by subscription plan ID |
state | StringOperator | Filter by subscription state |
Example with subscription data:
query { users(page: 1, perPage: 20) { nodes { id name subscriptions( filter: { planId: { eq: "abc123-983dsf8" } } ) { nodes { id planId state createdAt } } } currentPage totalPages }}