mullr
Member
Registered: 2005-10-30
Posts: 67
It'd be great to see a simple API for getting status information. I'm imagining some basic things like:
- Cards pending for review
- slot breakdown, like in http://kanji.koohii.com/main.php
- Kanji count from http://kanji.koohii.com/showprofile.php
- The per-lesson info from the front page (lesson m of n, p to go)
A simple xml response that contains all this data would be perfect. That would make it easy for people (like me) to do a dashboard widget or a facebook app to fetch status. I've got a web clip of main.php on my dashboard now, but it's a bit large for such an application.
Thanks for a great site!
ファブリス
Administrator
From: Belgium
Registered: 2006-06-14
Posts: 4021
Website
I've started working on this but there's some problems I need to work out :
Someone could potentially send request to the script thousands of times, for example to collect the data for each user on the members list, and that's not ok because it would eat up too much resources on the server.
One solution to save excessive queries on the database would be to store the requested data into the session, but I think that's tied to the IP.
It's the Facebook servers which will do the request to the script here I guess, based on your App/Widget? But do they send their own IP or the IP from the user?
If it's the IP from the user I could store the results in the session data, if it's the IP from some Facebook server, it could be the same for different users and that wouldn't work.
meolox
Member
Registered: 2007-08-31
Posts: 386
What I would find useful for an API would be a cached XML or JSON file of information for each kanji, this cache need not be updated too often, perhaps once a week. For example to write an app that fetches the most popular story for a given kanji from the site I'd need at minimum a means of passing a kanji on the url to return a file with all information associated with that kanji, stroke count, frame number, a list of the public stories, stars, reports and author of each story.
I'd expect the easiest way to do it would be to pass an API key via the url and the required API function
returning a page...with information for that kanji parsed into XML or JSON format.
You could give API keys only to people who apply for one, that way it'd be easy to maintain a list of who is using the API and send email updates if you need to make changes which could potentially break applications.
I'll try and think of more use cases....
EDIT: That designing a good API keynote is interesting, another use case:
- Fetching details of a user -
Data sent to API:
API Key
Username
Expected Return Data:
Username, Location, Kanji Count, Total Reviews, Joined, Last Login
I'm sure some other people could chip in some use cases, example data for applications they'd like to write to take advantage of the API.
Last edited by meolox (2009 November 17, 5:03 am)