Stefany93 wrote:quantumf wrote:Stefany93 wrote:Thanks for the explanation...
If it is impossible then what can we use it for

You can build a website that shows some stats about KGS players. Whether you should or why you would are questions you or others will have to answer.
Oh, super nice. I can write an script with it to put a chart or something on my portfolio...
Thanks for your comment. That's one of expected ways to use the API, writing your own tiny application related to KGS.
All you can do is to get some resources from KGS *web* server, such as a list of games played by you, and do something with the data.
You can neither write a plugin to extend the KGS GUI client nor log in to KGS using the API.
MetaKGS API is read-only. It's just a set of methods which simply returns the requested resource.
(quantumf's explanation is very helpful. Thanks)
Javascript example:
Code: Select all
// using jQuery
$.getJSON('http://metakgs.org/api/archives/YourAccount', function (data) {
var games = data.content.games; // => Array containing game objects
for ( var i = 0; i < games.length; i++ ) {
var game = games[i];
game.type; // => "Ranked"
game.sgf_url; // => "http://files.gokgs.com/.../foo-bar.sgf"
game.board_size; // => 19
game.handicap; // => 4
game.started_at; // => "2015-02-04T12:34Z"
game.result; // => "B+Resign"
game.black; // => Array containing player objects whose length equals to 1 (2 for rengo games)
game.black[0].name; // => "foo"
game.black[0].rank; // => "2k"
...
}
data.link.prev; // => link to previous month
data.link.next; // => link to next month
...
});
Unsolved problems:
- SGF files can not be read by client-side Javascript due to the same-origin policy, and so you can neither parse the SGF nor replay the game on web browsers.
- MetaKGS API is quite fragile since it depends on the HTML structure of the KGS web server, while I'm checking the update on
Travis CI once a day
Feel free to ask about any unclear points here or on GitHub issues.
Have fun with MetaKGS API!
Update: I visited your website (cool) and found your WordPress plugins. I believe you can write a WordPress plugin related to KGS using MetaKGS API, such as a calendar widget which includes win/lose count per day.