beardon / canvas-lms-api

Promise-driven accessor for the Canvas LMS API
5 stars 3 forks source link

Canvas paging #5

Closed stuartf closed 8 years ago

stuartf commented 8 years ago

Canvas pages result sets (larger than 10 by default): https://canvas.instructure.com/doc/api/file.pagination.html

Am I missing something, or does this library not support paged responses?

I have a branch in progress that will detect the Link header and recursively request more pages until it has them all, but it's currently running into Canvas' throttling: https://canvas.instructure.com/doc/api/file.throttling.html

tyscorp commented 8 years ago

I've been meaning to add support for pagination for a while but haven't gotten around to it.

Currently, we're just setting { per_page: n } to a number higher than we'd ever expect to hit.

Are you running into throttling on a local or cloud installation of canvas?

stuartf commented 8 years ago

It's a cloud installation.

stuartf commented 8 years ago

Here's what I'm doing for autopaging: https://github.com/stuartf/canvas-lms-api/tree/autopaging it just needs to check the X-Request-Cost and X-Rate-Limit-Remaining headers and use bluebird's .delay(ms) so it doesn't just blow through the requests.

tyscorp commented 8 years ago

Would you please set up a PR for review/merging?

stuartf commented 8 years ago

yeah, I'll send a PR once I get the throttling code in

stuartf commented 8 years ago

I've attached a PR to this issue.

austinoneil commented 8 years ago

Can you please remove me from this repo? On Jan 19, 2016 2:34 PM, "D. Stuart Freeman" notifications@github.com wrote:

I've attached a PR to this issue.

— Reply to this email directly or view it on GitHub https://github.com/beardon/canvas-lms-api/pull/5#issuecomment-172994150.

tyscorp commented 8 years ago

Landed in 3ab9a118e765300dc30853d307e3b875d4643eca and c31d3d5a9dbd3fc115e7f10519af2a6c23676bfe with minor style changes.

tyscorp commented 8 years ago

Thanks!