Using API to build up an iOS Widget

Ever since iOS 14 brought us widgets on iPhones I’ve been dreaming of Skritter widget on my iPhone. What I specifically would like to do is a widget that would show me a random word from the list of words that I’ve last failed. There is a cool iOS app “Scriptable” that I used to build myself a “random HSK 3 grammar point” widget.

Now, my question is, could I somehow do similar things with Skritter API, a bit of JavaScript, and Scriptable? More specifically how do I start using the API (that I know exists because of rather old blog posts here) and could one implement something like that with the API? I guess the authentication part is the tricky bit but using the API probably would be easier?

(not sure which sub-forum this belongs, feel free to move it to more appropriate place if you want to)

I think a Skritter widget would be a cool idea, but our priorities are currently in other areas. The documentation for the API is here:
The v2 and v3 APIs largely work with the same or similar data, just in different or more optimized formats for certain clients. As they’re in-development moving targets, we currently don’t have plans to document them yet.

We don’t have a lastFailed date on the UserItem, only an updated timestamp and a count of the attempts and successes (you can derive failures through something like failures = attempts - successes), so it’d be a bit tricky to get the sort order you seem to want. Unless you mean you simply have a list you add to of words that you have trouble with or something. Pulling a random word from that should be pretty straightforward.

All that being said, having the ability to re-test only the failed content of a study session is a feature we’ve got planned for a future mobile app release, so it’s coming!

1 Like

Yes, while I would very much prefer a widget from you at the Skritter, I do realize you probably have more important things on your todo list.

Does the API have convenient access to what is up next for review? Maybe that could be a proxy for ”I failed with this word recently”, close enough to create a widget that picked a random word for to be shown on the widget?

I’ll keep you posted on progress I have with my DIY widget or lack there of :slight_smile:

There’s a few ways you can do it, explains a couple options that will get you a somewhat sane ordering of data to work with that I think will be enough for a simple widget.

In the app we do a bunch of extra re-sorting and heuristics to make the reviews “feel” more pleasant while still generally keeping the SRS ordering (e.g. we make sure different reviews for the same vocab don’t appear back-to-back, or that a user doesn’t get 50 writing prompts in a row, etc). But if you’re focused more on just showing a single piece of information, I think that endpoint will give you something meaningful to work with without too much extra work.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.