Skip to main content
We are sharing an in-development version of our API to test integration patterns and gather early feedback as we continue to refine the offering.

Pagination

Limit-based pagination

For simple queries, you can use basic limit-based pagination.
query {
  lessons(limit: 10, offset: 20) {
    identifier
    name
    gradeLevel
  }
}

Cursor-based pagination

The API also supports cursor-based pagination with Connection fields. All paginated queries use the pattern nodeTypesConnection:
query {
  lessonsConnection(first: 10, after: $cursor) {
    edges {
      node {
        identifier
        name
        gradeLevel
      }
      cursor
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

Implementation

import os
from gql import Client, gql
from gql.transport.requests import RequestsHTTPTransport

# Setup client
transport = RequestsHTTPTransport(
    url=os.getenv("API_ENDPOINT"),  # Set to the API endpoint
    headers={"x-api-key": os.getenv("API_KEY")},  # Your API key from 1Password
    use_json=True,
)

client = Client(transport=transport, fetch_schema_from_transport=True)

def fetch_all_lessons():
    cursor = None
    has_next_page = True
    all_lessons = []

    query = gql("""
    query FetchLessons($first: Int!, $after: String, $where: LessonWhere) {
        lessonsConnection(first: $first, after: $after, where: $where) {
            edges {
                node {
                    identifier
                    name
                    gradeLevel
                    courseCode
                }
                cursor
            }
            pageInfo {
                hasNextPage
                endCursor
            }
        }
    }
    """)

    while has_next_page:
        variables = {
            "first": 50,
            "after": cursor,
            "where": None  # Add filters here if needed
        }

        result = client.execute(query, variable_values=variables)
        connection = result["lessonsConnection"]
        nodes = [edge["node"] for edge in connection["edges"]]
        all_lessons.extend(nodes)

        has_next_page = connection["pageInfo"]["hasNextPage"]
        cursor = connection["pageInfo"]["endCursor"]

    return all_lessons

# Example usage
if __name__ == "__main__":
    lessons = fetch_all_lessons()
    print(f"Fetched {len(lessons)} lessons")

Pagination with filtering

You can combine pagination with filtering for more targeted queries:
query {
  lessonsConnection(
    where: { gradeLevel_INCLUDES: "K" }
    first: 10
    after: $cursor
  ) {
    edges {
      node {
        identifier
        name
        gradeLevel
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
For very large datasets, consider using smaller page sizes (25-50 items) to optimize performance and avoid timeouts. The client side can use retry logic that automatically reduces page size exponentially on server errors (e.g., from 50 to 10 to 2 items) to handle resource constraints gracefully.

Best practices

  • Use Pagination: Always implement proper pagination for large result sets
  • Limit Field Selection: Only request fields you need to minimize response size
  • Implement Retry Logic: Handle rate limits and server errors gracefully
  • Cache Results: Cache frequently accessed data to reduce API calls
  • Monitor Usage: Track your API usage to stay within rate limits

Limitations

Early access scope

This API is being provided for early testing and feedback purposes only. It is subject to change or deprecation without long-term support guarantees. We recommend using this version solely for development and experimentation, and not for production systems or any critical use.

No uptime guarantee

This version of the API does not include an uptime guarantee or formal SLA. Interruptions or outages may occur as development continues. It should not be used in contexts that require high availability or reliability.

No query response time guarantee

We do not guarantee response times for this version of the API. Performance may vary depending on factors such as query complexity, system load, and infrastructure conditions.

No limit on query complexity

There are currently no enforced limits on query complexity, depth, or size. While this offers flexibility for testing, overly complex queries may impact performance or cause timeouts.

Rate Limiting

Rate limiting is applied to this API to help ensure system stability. Please plan your usage accordingly. Limits may be adjusted based on system performance and usage patterns.

Endpoint URL may change

The endpoint URL for this API version will change upon production deployment.

Support availability

We will do our best to address issues reported during this period, but please note that there is no formal service level agreement (SLA) associated with this version of the API.