Skip to main content

How to get number of items/pages for pagination?

  • February 5, 2020
  • 2 replies
  • 3944 views

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

This topic has been closed for replies.

2 replies

  • New Participant
  • March 27, 2020

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

  • February 25, 2021

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.