@dan_baeckstrom
I'm a slow typist. When I started typing, there was no reply.
Unfortunately, your solution isn't a complete solution. Unless you are self-hosting and have changed the limit in the source code, the limit on the number of pages is 100, not 1000. You can specify per_page=1000, but it won't use 1000, it will stop at 100. You will need to look into pagination from the API to get the additional pages.
For example, when I try /api/v1/courses/3119582/pages?per_page=1000, I get a Link header that looks like this (protocol and hostname stripped out for legibility and to prevent creation of links).
Link:
</api/v1/courses/3119582/pages?page=1&per_page=100>; rel="current",
</api/v1/courses/3119582/pages?page=2&per_page=100>; rel="next",
</api/v1/courses/3119582/pages?page=1&per_page=100>; rel="first",
</api/v1/courses/3119582/pages?page=2&per_page=100>; rel="last"
This particular course has 163 pages in it.
Notice that it has decided to change my per_page=1000 to per_page=100 and that it takes 2 pages (rel="last") at 100 each to display all of the pages.
If you follow the directions on the Pagination page in the documentation, then it will have you load the pages sequentially and so if you have a lot of pages (more than 200), it can take a while.
What I do in cases where the page= is a number is to fetch the first page, look at the header, and then fetch the remaining pages in parallel, sometimes using the Bottleneck library to stagger and limit the number of simultaneous requests so they don't all hit at once and hit the x-rate-limit-remaining threshold that stops all additional calls. That's unlikely to happen with pages, but some requests are expensive.
When I do this, I normally fetch a smaller number, like 50, with the first request so that it returns quickly (a request for 100 seems to take longer, even if there are only 50). Then I determine the final page based on the rel="last" and then generate all of the remaining links and send them concurrently.
GraphQL provides a way to fetch just the information that you need for some API calls and doesn't have a limit on the number of items returned. You can still ask for too many and it may time out, but it's not a fixed number of items like the REST API. Unfortunately, pages are not supported by graphQL, so you will need to use the REST API for pages.