AnsweredAssumed Answered

Grab a list of users who have passed assignments

Question asked by Stephen Taylor Champion on May 8, 2020
Latest reply on May 19, 2020 by Stephen Taylor

I've just begun playing with api's and powershell and I think I've managed to wrap my head around the basics.  I'm just really stuck with the pagination of canvas.  I can pull 50 submissions from a course and filter out all bar the passes - which is what I'm interested in.  But I can't get it to wrap to the next page, I think it's going to be using the while function but I don't know what to put in it as the condition or the statement.  Does anyone have any idea what I need to add to it?  

 

This is what I have so far:

 

$headers = @{"Authorization"="Bearer "+$token}

$uri = “https://bfc.instructure.com/api/v1/”
$my_page = ((Invoke-WebRequest -headers $headers -uri "$uri/courses/547/students/submissions?student_ids[]=all&workflow_state=graded&sort=id&per_page=50.json").content | convertfrom-json) | Where-Object -property grade -eq "Pass"
$my_page | Select-Object -property id, grade, user_id, assignment_id

 

I'm also aware this may not be the best approach to grab a list of all users and grades on a course - if not what way should I approach it?

Outcomes