Trying to perform a GET API Call and only return values that satisfy a condition

My goal is to connect to a Japanese learning website’s API and retrieve a list of study materials (specifically, Japanese kanji). To give you an idea of what I’m dealing with, this is what the response from such a call would look like. Do note that this list goes on into the thousands of entries:

The idea is to put those kanji in a repeating group. However, I want to have some control over which kanji are actually displayed. Specifically, I want to display only kanji of a certain level (referring to the level key in the screenshot above).

I’m able to do the first part (displaying kanji in a repeating group), but can’t get the result to limit itself to kanji of level 5:
image

I don’t know what the correct approach is here. I’ve played around with numerous URL queries, but I can’t get it to work. Neither am I able to somehow filter the results using the dynamic data field for the repeating group.

My API call currently looks like this:

As you can see, I’ve already used a URL query to limit the results to just kanji (there are also other types of results that would otherwise be included, like vocabulary)

I tried adding another parameter like level=5 but the API doesn’t seem to recognize it, and the reference material for the API doesn’t seem to say that such a parameter is even possible:
https://docs.api.wanikani.com/20170710/#get-all-subjects

If anyone could point me in the right direction with this I’d be really grateful.

I searched the docs looking for a “filter” option.

` WaniKani API Reference

They don’t give a great example there, but my guess would be that on your API call you can add this to the end:

&level=5

And that might work! “Simple” as that.

I figured it out.

Truth is, I already using &level=5 and it didn’t work.
Turns out, it needs to be &levels=5, with an s at the end.

This makes no sense to me, given that the attribute provided by the API reference material calls it level, not levels. Either way, this worked. Maybe I’ll learn some time in the future why. Thanks for responding!

1 Like