API V2 Beta Documentation

#605

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

#606

Thank you! I completely missed that!

0 Likes

#607

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:
https://docs.api.wanikani.com/20170710/#subjects

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

Happy Kanji Learning,
Viet

2 Likes

#608

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? )

0 Likes

#609

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

#610

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

0 Likes

#611

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

1 Like

#612

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

#613

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

#614

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

0 Likes

#615

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

#616

@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.
0 Likes

#617

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

For 2 I honestly don’t see that happening.

0 Likes

#618

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

#619

@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>
0 Likes

#620

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

#621

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

0 Likes

#622

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

0 Likes

#623

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.

0 Likes

#624

Easy enough! Much appreciated

0 Likes