ATTN Developers: Please use smaller API requests

This post is about one of the limitations of WaniKani’s API that primarily affects high level users and prevents them from using some API apps.

WaniKani’s API has an undocumented timeout of 30 seconds for any API request. If the request takes longer than 30 seconds WaniKani will return an HTTP 503 error (the missing turtles error if viewed in a browser). In most cases this isn’t an issue as requests are small enough to be completed in less than 30 seconds. However in the case of high level users attempting to request their entire Vocabulary list will usually timeout.

To solution to this is to request items in smaller batches; you can probably request more but 10 levels is a safe amount to ensure that the request doesn’t timeout even when WaniKani is under heavy load.

tl;dr Requesting all 50 levels of Vocab data will fail for high level users; to avoid this, make requests in batches of 10 levels instead.

Is there any way we can find out what our usage is like from WK’s end? My site currently (once a day) pulls 50 levels worth of vocab all at once. I’ve yet to have it timeout, but maybe that’s because I’m doing it at 3AM…

Edit: Scratch that, I just realized I re-wrote it a while ago to pull one level at a time. 

It doesn’t seem to fail for lower level users as they don’t have enough data. It’s not until some point around level 30 that it seems to become an issue.

Also it seems like large multi-level API requests might actually take longer than the same number of levels in separate smaller requests.

Yeah it’s annoying.

I just cut vocab request in 2 requests of 25 levels.
Kanji request does not need to be cut afaik.

I have updated my fork of the timeline to include dynamic vocab request splitting.
Should be level-60 compatible for someday.
https://greasyfork.org/en/scripts/5585-wanikani-timeline