Code to figure out how many radicals I have in guru?

Hi all -

I’m trying to create a Google Apps Script Javascript code with the new API 2 that will help me track my progress in WaniKani. It would pull info from WaniKani once a day, and automatically update a Google Docs sheet on a new row with the data. I’m having trouble with java script though.

To make this request as simple as possible, all I want to do is figure out a code that will pull how many radicals I currently have at the Guru level. I can figure out the rest from there, I think.

What is the simplest code that can do this? I so far am able to pull the raw data from the API 2, and that code is below. Now how do I pull from the raw data how many radicals I have at the guru level?

var apiKey = '[Insert API key here]';

function fetchData2() {


var raw = UrlFetchApp.fetch('https://api.wanikani.com/v2/reviews', {
    method: 'GET',
    headers: {
        'Wanikani-Revision': '20170710',
        'Authorization': 'Bearer ' + apiKey
    }
})

  var parsed = JSON.parse(raw);

}

Thank you!

Maybe you could save yourself a lot of trouble by trying Item Inspector. You can answer a lot of questions by creating a table with the right filters. In your case just set the item type filter to radical ad the srs level filter to guru1 and guru2. Not only you will get your answer but item inspector will show you which ones and let you export their data.

Disclosure: I am the author of Item Inspector.

3 Likes

Hi prouleau -

Thank you! I actually was able to write a code that worked, with some help from the community on this thread - WaniKani Google Sheet—Pull data from API version 2 to Sheet - #23 by kusuri

However, it’s returning numbers that aren’t quite right. Maybe you can help as to why. For example, my code (as well as Viet’s code) returns that I have 135 burned radicals as of today. However, the WaniKani website says I have 134 burned radicals. Please check the last comment on that thread for more details.

I am happy that you found a solution that works for you. It seems that Viet found a solution to your mystery.

I suggest you still check what Item Inspector can do. If you have a one off question who is not worthy to put in a spreadsheet Item Inspector may be the quickest way to answer it.

Wkstats.com also has the data you seek :blush:

Presumably one of the radicals you have burned has been removed from WK