canvas-api icon indicating copy to clipboard operation
canvas-api copied to clipboard

.next sometimes give strange results

Open etsikt opened this issue 9 years ago • 0 comments

I noticed that the following code sometimes listed all the users in the course instead of only the users in the section (sid is section id and aid is assignment id):

uri = sprintf("/api/v1/sections/%d/assignments/%d/submissions?include[]=submission_comments",sid,aid)

submissions = canvas.get(uri)
processSubmissions(canvas,submissions)
while submissions.more?  do
  submissions = submissions.next_page!
  processSubmissions(canvas,submissions)
end

Calling the url in the web browser: https://matematikk.mooc.no/api/v1/sections/175/assignments/130/submissions?include[]=submission_comments&page=2

makes me think it only happens for sections that return more than one page.

The workaround for me was to add per_page=1000

etsikt avatar Oct 09 '15 13:10 etsikt