year that still means that all those software breaks
Right. The developers of those scripts will have to switch to the new API.
Or new people will develop new scripts. Itâs not like the community is dead or anything.
Yeah, I think for the scripts that are really desirable, we have enough coders here that they will be updated. In fact, thatâs how I got started with userscripts: adapting Timeline from a Chrome browser extension after the original author left and support for the extension was dropped.
All of my scripts will be converted over the next few weeks now that the Open Framework (for APIv2) is released.
Hi, Iâm new to this API.
It looks like itâs all readonly endpoints? Or is it possible to develop a native iOS app that can do reviews?
As it stands right now, itâs read-only. For the native iOS app, youâd need to follow the lead of the other mobile apps that are out there right now and use web views to include the lesson and review interfaces. There are some gotchas around authentication with that (mainly that itâs kind of painful either with an API key or trying to use their username and password).
(cuts himself off from talking about exciting upcoming changes â but not before the words âwritable endpointâ and âOAuthâ slip out in the mumbling)
Some changes which are now live:
- All Subject.type
radicals
character_images
now output a collection of assets: PNG visual representations in various sizes, CSS-stylized SVG and SVG without any CSS embedded stylization. - Subjects now have attribute
hidden_at
. When a subject is removed from the user facing component of the application the attribute will be timestamped. - Assignments, Review Statistics, and Study Materials now have attribute
hidden
. When the related subject is hidden, this attribute is set totrue
. -
hidden
filter is available to the collection endpoints of/subjects
,/assignments
,/review_statistics
, and/study_materials
. - The default scope of the endpoints
/subjects
,/assignments
,/review_statistics
, and/study_materials
is to show both hidden and non-hidden subjects.
And here I was hoping that this was hinting at an upcoming feature to let users hide (aka suspend) reviews for individual items that may be bogging them down.
Awesome! Iâve been looking forward to this.
Just a note for everyone:
To make use of the un-styled radical SVGs (which allow you to centralize the CSS in one place), you can add the following CSS to your page:
svg.radical {
fill:none;
stroke:#000;
stroke-linecap:square;
stroke-miterlimit:2;
stroke-width:68px;
}
@viet,
The SVGs with style donât have class="radical"
. I didnât know if thatâs intentional. I donât guess I have an opinion either way⊠I just happened to notice it.
Also, looking at the character_images
collection, since the array contents are in a different order in each item (based only on looking at subject_id=1 and subject_id=400 so far), I would be interested in having a more machine-friendly field for identifying the contents.
For example, on the SVGs, maybe something like:
"has_style": true
And for the PNGs:
"size": "32x32"
or
"size": 32
??
Any thoughts from other scripters and app developers?
[edit: As long as the description isnât likely to change, though, a simple match against the description would work fine]
Sorry for not getting back sooner.
Darin and I chatted over this last week. I think we will drop the description
attribute (it is a humanized description, which we are now thinking it isnât appropriate) and add a metadata
attribute with an object value. The metadata
will contain details depending on the content_type
. This should make it machine-friendly.
Will get back to you on that one.
I should expand on the main purpose of including these fields.
A while back a few developers brought up on how to identify subjects/assignments/review_statistics/study_materials which have been âdeletedâ from WaniKani. There wasnât a good way to do this, other than pulling the entire collection of resources. This is not ideal.
The developer is now able to identify items which have been soft deleted from the system. When a subject is âhiddenâ, the update cascades to related assignments, review_statistics, and study materials, which toggles their âhiddenâ attribute. This also touches the updated_at. If the updated_after
filter is leveraged, then it should be easy to identify if a subject has been removed from the system. Do note the resources can be toggled the other direction (hidden â unhidden); the fields will be reset back to null or false.
PSA: Weâre changing the URL for API v2 âyouâll find all your favorite endpoints at https://api.wanikani.com/v2!
The structure of the requests and responses stay the same, so update those base URLs and youâll be good to go. Weâre supporting traffic to the old endpoints for a couple weeks while everyone makes the transition, but weâll be tearing down the existing URLs on April 18.
As usual, let us know if youâve got any questions or concerns.
Just confirming that this particular notice has nothing to do with V1 URLs, correct?
Nothing has changed with V1. There are no plans of changing the base URL for V1 endpoints.
Open Framework is now switched over to the new APIv2 url.
Iâm currently working on a project where I need to fetch all review/assignment data at once. Is there a good way to go about this in a timely manner without putting a big load on the server?
For my personal data Iâll probably fall within the 60 RPM limit, but I donât know how thatâll look for higher level accounts. I might run into the limit there and then Iâd have to make the user wait until I can request again.
As long as youâre caching your result and making use of the updated_after
filter, full-data queries should be infrequent enough that it wonât matter to the server. Youâd probably only have a problem if, for some reason, a bunch of users decided to do a full-data query at the same time. But with caching, most queries should end up being very minimal incremental updates.
In the Open Framework, I just check for a rate-limit error (429), and do a retry after a delay. WIth each successive retry, I increase the delay. When it finally succeeds, I reset the delay back to initial.
Thanks for the quick reply! So Iâll just have to suck it up if I hit the limiter^^
I guess I could also calculate how many requests Iâm going to need and then set the delay accordingly so I donât run into the limiter. But depending on how long Iâll have to wait if I hit the limiter that might not even be faster.
Youâre probably better off not trying to sculpt your reviews to avoid the rate-limit. What if they increase or decrease the limit in the future? Or worse yet, adjust the rate dynamically?
Iâm definitely in favor of being considerate regarding server load. Under the old system, I spent a lot of time trying not to be an undue burden. But under the new API, with incremental query support, I think we donât have to worry about it as much, and theyâre better equipped to refine the server load on their end as needed.
But, of course, I donât speak for Tofugu. Iâm just a frequent API user
On a side-note⊠Iâm probably soon going to be responsible for their biggest live load-test yet. After I finish upgrading the Self-Study Quiz script to APIv2 this week, Iâm going to do a quick upgrade of Ultimate Timeline. Thatâs going to shift thousands of users onto APIv2 in a very short period of time.