Currently, when I do an API GET of displaying courses, for example ~api/v1/accounts/account_id/courses, its output is limited to 10 records only. How do you display all courses under said account?
All responses from Canvas are paginated. The default page size is 10 entries.
The API documentation on pagination isn't great: Pagination - Canvas LMS REST API Documentation
You can use the ?per_page parameter to set a larger page (e.g. api/v1/accounts/account_id/courses?per_page=100) but you can't just set this a huge number and be sure you'll get all your classes.
You need to find a way in your chosen language to make repeated requests until you've retrieved all the pages.
Here's a Python3 function I use (the editor has stripped indents)...
def get_courselist(): courses =  pagesize = 10 queryterms="?per_page="+str(pagesize)+"&&exclude_blueprint_courses=true" uri = 'https://awsacademy.instructure.com/api/v1/courses'+queryterms r = requests.get(uri, headers=headers) raw = r.json() for course in raw: courses.append(course) while r.links['current']['url'] != r.links['last']['url']: r = requests.get(r.links['next']['url'], headers=headers) raw = r.json() for course in raw: courses.append(course) return courses
I'm sure there are neater ways, I'm no programmer.
Another 'gotcha' I found - It only reports courses for the requesting user. This means if you created the API keys as email@example.com then you'll only see courses with bob enrolled (in any role).I've posted a question on this forum asking for a work around for that particular problem.
It sounds like you could benefit from this document: Canvas APIs: Getting started, the practical ins and outs, gotchas, tips, and tricks
Pagination and Masquerading are two things that often draw questions from new developers. They also have their own pages in the Basics section of the Canvas LMS API documentation.
Retrieving data ...