How can I use pagination at the root of a query in GraphQL?

chuck2
Community Member

I'm trying to figure out this new-fangled GraphQL API with hopes of speeding up a few of our slower REST API queries. I'd like to get a list of all courses for a given account (including sub-accounts), but I'm not sure how to create that query using pagination on the allCourses endpoint. I've tried this in GraphiQL:

query MyQuery {
   allCourses {
      _id
      name
      createdAt
   }
}‍‍‍‍‍‍‍

And I get the first 10 entries. But if I try:

query MyQuery {    
allCourses(start: 20) {...}
}‍‍‍

This gives me an error, saying "Unknown argument 'start'".

What am I missing? How do you do pagination for allCourses?

Thanks in advance for any help.

Labels (2)
0 Likes
Users who also had this question