Question about WK API subject id's

Hello, I’m not sure if this is a dumb question but I can’t seem to find the answer anywhere. I’m working with the WK api to make a (personal) site somewhat similar to help me in my studies. Since i’m quite a few levels into WK I’m using the API to help me fill out some details, and i’m storing all my “known” words (guru+) into a dictionary! The key is the WaniKani API subject id, and the value is all the useful info. Now… I want to be able to add different words to my dictionary, words that I know from outside of WK. Since my dictionary has the subject id as a key, I want to create an ID for the words added from outside of WK. Is there a guarantee somewhere of the range of digits the WK ids will be at so I know not to choose an id in that range, are the id’s completely random, or something else? I think if I wanted a long solution I could check to see if an object exists at a specific key I’m trying to add in, but that might end up being kind of slow! Thanks for any help

The WK subject_id values are currently linear, from 0 to somewhere around 9700. You could choose negative numbers for your “other” content.


Cool, just what I was looking for lol. Negative numbers make a lot of sense, thanks so much!

I believe most implementations of maps should have constant time complexity for lookups

1 Like

They most definitely do, I just was being lazy and assuming it would be slower than creating a unique id the first time every time, so I was hoping WK had an easy to work with system for labeling the ids, which it does! So now I don’t have to worry about it haha

1 Like