Hi,
What would be the most efficient way to get the list of students (users with enrollment type = 'StudentEnrollment') from a course object?
Thank you
What language?
List users in course - Courses - Canvas LMS REST API Documentation
<SPAN class="comment token">// jquery</SPAN><BR />$<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ajax</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN><BR /> url<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'/api/v1/courses/:course_id/users'</SPAN><SPAN class="punctuation token">,</SPAN><BR /> method<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'GET'</SPAN><SPAN class="punctuation token">,</SPAN><BR /> data<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN><BR /> enrollment_role<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'StudentEnrollment'</SPAN><SPAN class="punctuation token">,</SPAN><BR /> per_page<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">100</SPAN><BR /> <SPAN class="punctuation token">}</SPAN><BR /><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">done</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>r<SPAN class="punctuation token">,</SPAN> x<SPAN class="punctuation token">,</SPAN> s<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN>r<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Thanks so much Robert and James! This helped alot. At the moment I had the file outside of canvas and had a static Json file for testing. Once the Javascript was working the way I wanted, I was trying to fetch the dynamic JSON data from canvas page using the access token to test whether the Javascript still works, but it wasn't. The last part will be to upload the javascript into the theme, for it to fetch data within a canvas page and update in another. Please let me know if this process sounds correct? Will I still need a CSRF token to access pages once the file has been uploaded into the canvas theme?
I don't want to start a new question for this, as it seems mine fits this discussion...
Is it possible to get a list of all students in the system without passing a course_id? I am trying to make a 'tool' that allows administrators to see if a person has a Canvas account by searching for partial name/username across all courses. I know I can loop over course_ids but that seems like a lot more calls. I am not finding an API call that would do this.
I am calling the canvas API to get course Information. This is the endpoint that i am using /courses/{contextId}?include[]=account This is not returning the account.
Hi everyone, I am seeking some insight into how Canvas LMS handles HTTP errors and how they are reflected in the logs versus the user interface. We are currently observing the following behavior in our environment: Log-only errors: We are seeing 500 (Internal Server Error) and 503 (Service Unavailable) errors recorded in…
Hi everyone, If you write integrations against Canvas by Instructure at an institution — K-12, higher ed, corporate training, government, or anywhere in between — we'd love your feedback. We're running a short survey on the Canvas developer experience: APIs, data access, tooling, and documentation. Results will feed into…
I'm currently integrating an LTI tool and attempting to use the Activity.id.history https://canvas.instructure.com/doc/api/file.tools_variable_substitutions.html#activity-id-history variable, but I'm experiencing issues getting it to work properly. What I've Done: Added the Activity.id.history variable to my Developer…
I looked through the LTI Variable Substitutions documentation and while there are variable substitutions available for Canvas.term.name and Canvas.term.id (which is the Canvas incremented ID like "104"), I was surprised to see there was no option for Canvas.term.sisSourceId I tried testing other possible variants that may…