API V2 Beta Documentation

@viet

FYI This appears to be a bug introduce today in the v2 Wanikani api at or after 10:30am PST. Here are reproduction steps:

curl -H 'Authorization: Token token=<api-v2-key-for-hitechbunny>' 'https://www.wanikani.com/api/v2/assignments?page=2'

responds:

{
  "object":"collection",
  "url":"https://www.wanikani.com/api/v2/assignments",  
  "pages":{
    "next_url":"https://www.wanikani.com/api/v2/assignments?page=2",
    "previous_url":null,"last":8,"current":1},  ... 
  },
  ...
}

Hmm. It appears to be even worse. When I request page 3, I still get a response that says the next_url is page 2.

I hit the API with your credentials and this is what I am seeing the correct output:

{"next_url":"https://www.wanikani.com/api/v2/assignments?page=2","previous_url":null,"last":2,"current":1}

Do you have some sort of caching on?

Edit:

The response with ?page=2

{"next_url":null,"previous_url":"https://www.wanikani.com/api/v2/assignments?page=1","last":2,"current":2}

And with ?page=3:

{"error":"The page parameter must be less than the maximum page available"}

Complete red herring from me due to a caching bug on my end. Please disregard.

1 Like

New update out in a second.

We have updated date types to output ISO8601 with microsecond precision. This should address the updated_after filter.

Thanks! It’s looking good. Lots of accuracy now on those timestamps! :smiley:

@viet How’s the new API coming along? Any idea when it’ll go into beta?

There are a couple content additions we want to add before moving onto beta. It’ll be a little while longer.

A minor change.

For Kanji subjects, the reading object type now outputs the value downcased instead of capitalized.

Just want to give a heads up for those who have been utilizing the v2 alpha.

We are switching the parameter formatting of a filter collection to a comma delimited list very soon (the PR is currently being reviewed).

Before: ?levels[]=1&levels[]=3&levels[]=5
After: ?levels=1,3,5

This applies to all pluralize filters (ex. subject_ids, levels)

It’s a breaking change, but this is alpha :slight_smile:

4 Likes

Here is an outline of what we plan on doing before we ship the API:

  • Implement comma delimited list filters instead of form arrays
  • Implement /reviews endpoint (read only; srs state before evaluation, wrong answer counts)
  • Implement /level_progressions endpoint (timestamps of important events such as unlocked_at, started_at, passed_at, completed_at, abandoned_at [for resets])
  • Change handling of resets (records still persist, but data cleared out. Should address this issue.
  • Add radical SVG (and PNG) to subject radical objects (will be used as the primary visual for radicals)
  • Implement soft deleting
  • Proper API documentation

And items we will add, but won’t hold back the API release:

  • Add vocabulary audio and sentences (this is pending API terms we are getting draft up)
  • Authentication endpoint to grab API key
3 Likes

New updates:

  • Switched over to comma delimited list filters instead of form param arrays for multi element values (See doc for examples under the filter section)
  • Added /reviews endpoint
  • Added /level_progressions endpoint
  • Updated the way user resets are handled, which affects the API. assignment and review_statistic objects of level greater than User’s new level will just have their data wiped out with the defaults and the updated_at timestamp will be touched.

Updated the outline below:

1 Like

I guess this would handle when individual user data is no longer relevant, but what about when you remove content from WaniKani? Is there any way from the API to see if content was deleted?

I haven’t built scripts with the old or new API, so maybe nobody actually needs that. But I was curious.

Good point. We are going to have to look into this.

1 Like

YESSSS, this is so much better! It was a real hassle to do it the other way!

Loving the API updates btw :smile:

Quick update:

Added starting_srs_stage_name: to review objects.

The update will be live soon. Documentation has been updated.

Aaand live!

1 Like

Such a huge fan of the changes! Thank you!
Is there a radical content overhaul in the works as well? I’ve heard about this multiple times, but never from an official source.

We aren’t the best people to ask about content changes. That’s more @anon20839864 and @koichi domain.

The API v2 is mainly concerned with technical changes. I can tell you from the technical end we are moving towards using SVG for the primary radical visuals instead of using a missmash of custom fonts and existing unicode. We will distribute the SVG (and PNG) via the API, and will include unicode as secondary information if it exists.