Simple API

Index » Feedback

  • 1
 
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!

meolox Member
Registered: 2007-08-31 Posts: 386

I'd also really like to see this, It wouldn't take long to set up and could provide for alot of amazing apps that takes advantage of the site.

Dashboard widget please smile

mullr Member
Registered: 2005-10-30 Posts: 67

After thinking about this a little more, it'd be great if this info could be had without a login: something like http://kanji.koohii.com/stats.php?user=mullr.  That would make the widgets that much easier to write.  No problem if that doesn't make sense though.

Advertising (register and sign in to hide this)
JapanesePod101 Sponsor
 
ファブリス Administrator
From: Belgium Registered: 2006-06-14 Posts: 4021 Website

Just curious, can you write them with login at all ? I wonder how that would work.

One potential problem is how many times this thing will be accessed, I would have to implement some sort of caching, because there's no sense in polling the database when the user is not actually using the site.

PS: JSON no-go? Believe it or not I never use XML, the site, especially the in-the-works area is all JSON. Much lighter and easier to user.

ruisu Member
From: New York Registered: 2007-09-04 Posts: 53 Website

ASP.NET has the very handy OutputCache directive. It would handle that in one line that looks something like: <%@ OutputCache Duration="1800" VaryByParam="none" %>

Maybe php has an equivalent?

mullr Member
Registered: 2005-10-30 Posts: 67

JSON would be great!

I'm not sure quite how the login stuff would work... I think you can call into native code from a Dashboard widget, so that could be doable.  But in general a no-login version would be more useful.

Last edited by mullr (2007 December 10, 3:08 pm)

ファブリス 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.

styrmis Member
From: United Kingdom Registered: 2007-01-17 Posts: 30

Glad to hear that we might get the API smile

About the request limiting, I'd recommend keeping it simple and throttling based on IP, even if that means the Facebook App users are occasionally blocked.

If you're receiving too many requests from Facebook servers then it doesn't matter if it's one or a few users who are causing it; the end result is the same (the server's resources are being exhausted).

Any applications which use the API will need to be designed responsibly such that they make the minimum number of requests required in order to achieve their purpose.

If you start by throttling everyone then maybe at a later date if there's a problem with access you could maintain a short whitelist of IPs which are allowed additional access.

Reply #9 - 2008 June 13, 6:54 pm
syntoad Member
From: Amagasaki Registered: 2006-11-05 Posts: 49

Any status on this? I'm starting to work on my facebook app now that I have more time and I'd be awesome to be able to link parts of it to this site.

meolox Member
Registered: 2007-08-31 Posts: 386

Any updates on an API ファブリス? I'd really like to write a google wave robot to fetch the most popular story for a given kanji.

ファブリス Administrator
From: Belgium Registered: 2006-06-14 Posts: 4021 Website

I need more "use cases". What kind of data you would expect? Suggestions for the API format of requests and so on. I really need to know what data yu're after and how you want to use it, and implement the least possible amount of API. Because once it's in its very hard to change.

"You can easily add but not remove" from an API
http://particletree.com/features/how-to … b-service/

Especially: How to design a good API !
http://lcsd05.cs.tamu.edu/slides/keynote.pdf

Otherwise for authentication I guess each user can have its own unique API key available in his profile.

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)

ファブリス Administrator
From: Belgium Registered: 2006-06-14 Posts: 4021 Website

But why do you need to get the details of another user from the members list?

meolox Member
Registered: 2007-08-31 Posts: 386

ファブリス wrote:

But why do you need to get the details of another user from the members list?

I meant the details of the person who would use an application written to interact with the API, not one memeber fetching the details of another.

Last edited by meolox (2009 November 17, 8:49 am)

ファブリス Administrator
From: Belgium Registered: 2006-06-14 Posts: 4021 Website

Doh :p

  • 1