API V2 Beta Documentation

According to the docs, the assignments endpoint started_at property says when the lesson was completed.

so the following request:

curl -X GET "https://api.wanikani.com/v2/assignments?subject_ids=14" 
    -H "accept: application/json" 
    -H "Wanikani-Revision: 20170710" 
    -H "Authorization: Bearer {API_TOKEN_HERE}"

Gives something like this (for me):

{
  "object": "collection",
  "url": "https://api.wanikani.com/v2/assignments?subject_ids=14",
  "pages": {
    "per_page": 500,
    "next_url": null,
    "previous_url": null
  },
  "total_count": 1,
  "data_updated_at": "2019-02-03T04:19:27.679622Z",
  "data": [
    {
      "id": 1887537,
      "object": "assignment",
      "url": "https://api.wanikani.com/v2/assignments/1887537",
      "data_updated_at": "2019-02-03T04:19:27.679622Z",
      "data": {
        "created_at": "2017-05-05T04:07:05.436336Z",
        "subject_id": 14,
        "subject_type": "radical",
        "srs_stage": 8,
        "srs_stage_name": "Enlightened",
        "unlocked_at": "2017-05-05T04:07:05.436336Z",
        "started_at": "2018-12-09T07:35:23.305115Z",
        "passed_at": "2017-05-06T23:36:31.279045Z",
        "burned_at": "2017-10-24T20:43:33.656484Z",
        "available_at": "2019-06-03T03:00:00.000000Z",
        "resurrected_at": "2018-12-09T07:34:25.731430Z",
        "passed": true,
        "resurrected": true,
        "hidden": false
      }
    }
  ]
}

So, I did the lesson (after resurrecting in this case) on December 9, when I first unlocked it May 5 the previous year.

1 Like

Thank you! I completely missed that!

Copy and pasting the email I sent out to the API list

Hi all,

Welcome to the first WaniKani API V2 email!

Will keep this email short and sweet.

We have added lesson_position to the /subject resource payload. This is used to order the subjects in lessons. The value is scoped to the subjectā€™s level.

For example you may see the following:

Subject A with lesson_position equal 2 and belongs to level 1.
Subject B with lesson_position equal 1 and belongs to level 1.
Subject C with lesson_position equal 1 and belongs to level 2.
Subject D with lesson_position equal 2 and belongs to level 2.

In lessons the subjects will be ordered as such: B, A, C, D.

In WaniKani we default order lessons by the ascending subject level, and then by type (radical, then kanji, and then vocabulary). What we donā€™t tell you is the subjects in each subject type are also ordered. This is what the lesson_position represents.

We have updated the documentation:
WaniKani API Reference

Any questions and concerns please post in the API V2 Beta topic:
API V2 Beta Documentation

Happy Kanji Learning,
Viet

2 Likes

Is it possible to let a user reset an item? I am thinking of creating something that allows a user to review all their burned items and reset them to apprentice in case they have forgotten them ( since itā€™s impossible to give them a new SRS stage, isnā€™t it? )

Via the API? Not at the moment. It is on the docket though.

Edit:

You can get an idea of whats upcoming for API updates by looking at the pull requests on the documentation repository.

We are adding PUT/POST on many of the endpoints right now. Just a matter of time before we get around to a reset action.

5 Likes

I thought that was a feature already in @rfindleyā€™s Self Study Quiz script, but it looks like Iā€™m wrong.

The script is using an internal endpoint. We donā€™t endorse using it and it is at your own risk.

1 Like

Awesomeee, Iā€™ll wait patiently. Giving an item a new (lower) SRS-level might be a thing then, as well? Allowing someone to just push back an item to Enlightment or just Guru.

1 Like

Youā€™re thinking of my Burn Manager script. Or maybe the old Burn Reviews script.

As viet said, mine is using the same internal URLs that WK uses for resurrect/retire, which may change without notice.

1 Like

Ah. Probably Burn Reviews then. I never used it myself, but I was sure something like that existed.

A gentleman doesnā€™t use internal endpoints. You ā€¦ scoundrel, you! :wink:

Actually, most of my job is based on achieving unsupported interoperability using internal APIā€™s, just usually on the desktop, not the web.

3 Likes

@viet I have a general question not directly related to the API, but then some follow up questions that are related.

Do you have data indicating the highest level someone has reached? That is, if they were level 60 and reset, do you know that they used to be level 60? Itā€™s come up a couple times recently that it would be nice if there was an indicator on the forums that you were once level 60 even if you reset. (I like the idea of a gold ring around the level badge.)

Now hereā€™s the two questions that relate to the API:

  1. If you do have this information, do you think itā€™s worth returning in the API?
  2. Have you considered exposing any public information about all users through the API (meaning you donā€™t need that userā€™s API key)? Specifically things that are already public on WaniKani profiles and this ā€œhighest levelā€ information that Iā€™m looking for.

For 1 you can find that information on either /level_progressions or /resets.

For 2 I honestly donā€™t see that happening.

Okay, thanks. Your response to #2 is understandable, though a bit unfortunate because it limits what we can do with the data as developers. For example, I canā€™t create a script showing people that used to be level 60 because I canā€™t know that about anyone other than myself (since I donā€™t have their API keys). But like I said, I get it.

Also, sorry for bugging you on the weekend. I honestly didnā€™t expect you to respond that fast.

1 Like

@viet @oldbonsai

URL access issues on the Coral radical.

https://cdn.wanikani.com/images/legacy/549-subject-8794-without-css-original.svg?1520987216

<Error>
  <Code>AccessDenied</Code>
  <Message>Access Denied</Message>
  <RequestId>xxxxxxx</RequestId>
  <HostId>
    xxxxxxxxxxxxx
  </HostId>
</Error>

Checking in to see if thereā€™s been any developments in adding POST functionality for submitting answers? Iā€™ve been itching for a new Android project outside of work, I just refuse to play with webviews in 2019 :smiley:

Apologies if this is a taboo topic or has been beaten to death already!

1 Like

You can simulate a login to get the token, then just use the post urls.

Thanks! Didnā€™t see that when skimming through the docs, Iā€™ll have a play around :smiley:

Itā€™s not in the docs or the API. Basically, just emulating a regular site login by seeing whatā€™s being transacted while logging in.
I use that method when running scripts that need my credentials to do things on WK.

Easy enough! Much appreciated