Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Response too large for /user/exercises call #94

Closed
capecodcid opened this issue Aug 27, 2015 · 4 comments
Closed

Response too large for /user/exercises call #94

capecodcid opened this issue Aug 27, 2015 · 4 comments

Comments

@capecodcid
Copy link

I can authenticate and make api calls in node.js using the request package. All api calls are working fine and returning data except for the /user/exercises call.

I get the following error:

Response status 500
undefined:1
HTTP response was too large: 35461733. The limit is: 33554432.
^
SyntaxError: Unexpected token H
    at Object.parse (native)
    at Request._callback (/Users/andrewhartnett/Documents/git/dgibson_khan/khan2.js:113:34)
    at Request.self.callback (/Users/andrewhartnett/node_modules/request/request.js:198:22)
    at Request.emit (events.js:110:17)
    at Request.<anonymous> (/Users/andrewhartnett/node_modules/request/request.js:1073:14)
    at Request.emit (events.js:129:20)
    at IncomingMessage.<anonymous> (/Users/andrewhartnett/node_modules/request/request.js:1019:12)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickCallback (node.js:355:11)

This limit does not seem to be imposed on the client side. Is it on the server side? Is there anyway for me to make this call?

Thanks,
Andrew

@alangpierce
Copy link
Contributor

Hi, sorry for the delay in responding to this. The problem here is that /api/v1/user/exercises was written a long time ago when we didn't have nearly as many exercises as we have today. When you don't specify the exercises parameter, it tries to load progress information for ALL exercises, even ones you've never attempted. Over time, we've added more and more exercises to the site, and now the response size is so large that it's hitting our server response size limits.

One workaround for now is that you can query for progress in a specific set of exercises by including the exercises parameter multiple times, like this:

/api/v1/user/exercises?exercises=counting-objects&exercises=count-from-any-number

However, some OAuth libraries have trouble with repeated parameters, so you may run into problems with this approach.

I'm working on a server-side change to make it possible to load progress just for exercises you've attempted at least once, which should hopefully fix the problem (except maybe for the most active users).

@capecodcid
Copy link
Author

Thanks! Can you keep me posted about when the server-side change is in place? Students at my school are required to work on their own playlist of Khan exercises for homework. I simply want to loop through exercises and my students to generate some quick reports for all math teachers.

@almartin82
Copy link

yikes - we are hitting this too (and I didn't realize it until this thread)

what is the server side limit?

(mobile)
On Sep 17, 2015 11:50 AM, "capecodcid" notifications@github.com wrote:

Thanks! Can you keep me posted about when the server-side change is in
place? Students at my school are required to work on their own playlist of
Khan exercises for homework. I simply want to loop through exercises and my
students to generate some quick reports for all math teachers.


Reply to this email directly or view it on GitHub
#94 (comment).

@alangpierce
Copy link
Contributor

Ok, I just deployed a fix to this. The new behavior is that /api/v1/user/exercises (without exercises specified explicitly) will load only exercises that the user in question has attempted at least once. This should significantly reduce the running time and response size, so responses should now be well within the 32MB response size limit.

I also made it a little easier to load a specific set of exercises. You can now just separate the exercise names with commas instead of using repeated query parameters.

I've also updated the documentation at http://api-explorer.khanacademy.org/api/v1/user/exercises to reflect this.

Thanks for your patience, and let me know if you run into any problems.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants