How to get number of items/pages for pagination?

Hey

Is there an API call that tells you how many items there would be in a particular query?

For example I want to run a simple script to pull all items from a particular board, I have it paginated and embedded in a loop, how do I know how many pages I need to loop through?

query test{
  boards(ids: 000000000) {
    items(limit: 25 page: 1) {
      name
      column_values {
	     title
        text
      }
    }
  }
}

Thanks

2 Likes

Great question not sure if this is possible from looking at the documentation, I was able to use a range and try else statement in python to loop through the number of pages I think the board has by using the code below. Let me know if you figured out a better way of doing this.

Blockquote
for i in range(1,8): #pagination
try:
results = queryboard(board,i) # i = page number

		print(i)
	except:
		continue