Pagination

The Altium 365 API uses cursor-based pagination following the Relay connection specification. Collection queries return a connection type containing a list of nodes, pagination metadata, and cursors for navigating forward or backward through the results.

Connection Structure

A paginated response has the following shape:

query {
  someCollection {
    nodes {        # the items on this page
      ...
    }
    pageInfo {     # pagination metadata
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    totalCount     # total number of items (all pages)
  }
}

Fetching Pages

Use the first and after arguments to page forward through a collection:

query {
  desProjects(first: 20, after: "{cursor}") {
    nodes {
      id
      name
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
  • first – number of items to return (page size)

  • after – cursor marking the end of the previous page; omit on the first request

The endCursor from pageInfo becomes the after value for the next page. Continue until hasNextPage is false.

To page backward, use last and before with the startCursor.

First Request

For the first page, omit the after argument:

query {
  desProjects(first: 20) {
    nodes {
      id
      name
      updatedAt
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalCount
  }
}

Use totalCount to determine how many pages to expect before starting to paginate.

Counting Without Fetching Items

If you only need the total count, you can omit nodes entirely:

query {
  desProjects {
    totalCount
  }
}

 

如您发现任何问题,请选中相关文本/图片,并按 Ctrl + Enter 键向我们提交反馈。
Content