To Our Amazing Educators Everywhere,
Happy Teacher Appreciation Week!
Found this content helpful? Log in or sign up to leave a like!
What api endpoint can be called to fetch a list of all courses in our system based on a course attribute?
The ultimate objective is to find the courses with a restrict_student_past_view attribute equal to 'false', so I can then use the Update Course Settings endpoint to change it to 'true'.
I thought the List your courses endpoint looked promising, but discovered that it only works for the user making the call.
Hey @swaldie -- the List your Course endpoint is equivalent to clicking on Courses -> All Courses in the user interface, hence why it only works with the user making the call.
You want to use the List active courses in the account endpoint -- unfortunately this doesn't allow you to filter by course attributes. You can use the options to filter down by subaccount or by enrollments (so only target courses that have an enrollment).
If you have a very large instance I suggest that you call this API endpoint via a subaccount rather than at root level (account ID 1) so that you're not pulling a large number of courses. I use Python so after getting the accounts I can filter the JSON to what I need.
I think there's a way to do this in GraphQL but I'm not well versed in it so I will leave that to others to chime in.
Hope this helps!
Thank you @melodyc_lam !
Your suggestion at least gets me closer.
To participate in the Instructure Community, you need to sign up or log in:
Sign In