I am wondering if there are any plans of adding a GraphQL endpoint? Looking at the examples of what people are working on, it seems as if it could make things a lot easier for both consumers of the API, as well as potentially decreasing the load on the server. I have put together a simple bridge for trying this out on GitHub in case anyone is interested (and it includes a bonus Python interface to the current API as well — does not support everything yet, but is easy to extend). The bridge can also be useful as a datasource for site generators and such. For those who haven't looked at GraphQL it is kind of an alternative to REST APIs, but with a couple of potential benefits: Allows you to specify the data you want in a single requests (mostly) You only get the data you specify — less traffic Has a very simple syntax which is easier than figuring out which endpoints to hit — and it is possible for tools to provide not only validation but also auto-completion and documentation for requests (see GraphiQL) Better for future-proofing, since the requests aren't tied to specific endpoints with certain parameters it is easy to add fields as needed (and has a way of marking deprecated fields) Since you specify the data you want in one go, there are more possibilities for back-end optimizations (and adding filters and such). Some examples: (I have added Python code to retrieve the same data which often looks similar to the GraphQL queries, but remember that it generates a whole series of requests which tends to be quite slow) Checking if a player is online: This is only one request in both cases, but illustrates the GraphQL syntax (note that I have just tried to map the existing API to GraphQL as directly as possibly, and there is plenty of room for improvements). GraphQL: { player(username: "chrka") { isOnline }} Python: chesscom.lookup_player("chrka").is_online() Getting player information for a club: You can specify variable in GraphQL queries (as well as breaking out fragments) to simplify reuse. Here we request the name and description of a given club, and retrieve info about the members (username, title if any, last time being online, when they joined the club and when they were active last, and their Daily chess ratings) GraphQL: query ClubRoster($club: String) { club(key: $club) { name description members { username title lastOnline joinedClub(key: $club) lastActiveInClub(key: $club) dailyRating: rating(category: "chess_daily") daily960Rating: rating(category: "chess960_daily") } }} Python: def club_roster(club_key): club = chesscom.lookup_club(club_key) name = club.name() description = club.description() roster = [] for member in club.members(): roster.append({ 'username': member.original_username(), 'title': member.title().value, 'last_online': member.last_online(), 'joined_club': member.last_active_in_club(club_key), 'last_active_in_club': member.last_active_in_club(club_key), 'daily_rating': member.rating('chess_daily'), 'daily960_rating': member.rating('chess960_daily') }) return roster Requires a total number of (2 + 3 * number of members) requests. (club profile, club members; members: profile, clubs, stats which returns a lot of info we don't need.
Since the direction of travel in the development of the chess,com API is to more closely align web page content with its endpoint equivalent, could the "rating" field per player be included in team matches in_progress & finished please? The information is given in matches in the registration stage but not after & I'm puzzled as to why that is. I'd like to use a club's archive of current & historical matches to gage their playing strength but at present I'd have to make separate endpoint requests per player to sweep up all the ratings data. The rating information is displayed in the web page, dynamically I believe, so is it possible to also give current ratings data in the endpoint of an historical match?
stephen_33 Nov 19, 2018
There is an inconsistency in the API endpoint URL pattern: https://api.chess.com/pub/match/{ID} This table shows how fair play closures are handled by web page and API in team matches. Shouldn't the API reflect the web page? Fair play closures Team match Status Player status Web Web team score Web board result Player status API API Team score API board result completed Closed As per boards As per boards Closed As per boards As per boards in progress Closed Adjusted Adjusted Closed Adjusted As per boards
https://api.chess.com/pub/player/{username}/matches "registered": [/** List of matches */{"name": "Name of match","url": "URL", // URL of match on web site"@id": "URL", // URL of PubAPI match endpoint"club": "URL", // URL of player's club endpoint} ] example CLUB data missing"name":"Across the pond friendly","url":"https://www.chess.com/club/matches/945209","@id":"https://api.chess.com/pub/match/945209"
Tricky_Dicky Nov 12, 2018
Hi, One of the things I use the stats endpoint for is for checking/finding members to invite. This turns out to be really slow. a) Start with the profile endpoint for last_online time, join date and (sometimes) location b) Grab the stats c) Get group memberships for the total number of clubs d) Go to their game archives to get the total number of current daily games. Now, note in (c) and (d) I'm only wanting a count, not the actual data. I think the total number of daily games would fit quite well into the stats endpoint. There are W/L/D records; any reason not to add number of in progress games to each of chess_daily and chess960_daily? The number of clubs someone is a member of might fit better into the profile than the stats endpoint, but if it were available in either I could at least halve the number of endpoints I need to use for this task. Thoughts anyone? I'm working with what I have and trying to cache more data to speed things up, but oh is it slow to collect some of that data to cache. I probably should have been more selective about what members I even looked up, but the single-threaded rate of queries per minute (it's better measured in queries per minute, not queries per second) is pretty damn slow. If there is intentional throttling (other than the number-of-connections thing) would someone please check that a zero hasn't been dropped? If I'm only getting 10% of the speed I'm supposed to be permitted I'd not be at all surprised. It's that slow, and pretty much across all the endpoints. I am using persistent connections (with https (SSL) an absolute must) and not using HTTP 2.0 (only 1.1) but compression of headers will not help; it's not a bandwidth problem or at least not a bandwidth problem anywhere near me, and the website has some chunky pages and is pretty zippy. Thanks for reading, Giles
Hi all. I recently wrote a Python script that returns a list of club members by activity. Everything is working just fine, but I have discovered that "activity" does not include things like playing in team chess matches, and posting in Vote Chess. I feel like that is a short coming of that endpoint. In all the clubs I belong to it is nice to see that people are posing in the notes and reading club news, but knowing who is supporting the team by playing in matches, tournaments, and vote chess is a much bigger concern. What are the chances that expanding that API endpoint to include who is playing chess games will happen? Thanks Bill
knightburgler Nov 5, 2018
I'd like some kind of authenticated endpoint that would enable CRUD operations related to analysis of completed games. At the MVP level some ability to export my analyses of games would be very useful to helping build tools for coaching and offline review.
I have a feedback for this club on chess.com clubs First there are 2 more ranks: The creator and the assistant creator The creator cannot be ban and can do all sort of stuff, the assistant creator can be banned by the creator and can do all sort of stuff, why did I gave this feedbacks? Because the creator is a super admin and super admins can ban each other so that means the "Non- creator" of the club can ban the creator even if he had done nothing wrong. If Chess.com cannot give my feed back well I have another feedback When you are demoting or banning and muting someone in the club: Everyone in the club must vote: 65% of them must agree is he will be demoted or banned. Here is what I thought too: When the club has 50, 100, 200, 300 and so on the club will automatically start a tournament which says <club name> 100 members tournament and the organizer is chess.com and the Super Admins in the club or Only the Super Admins in the club That's what I only thought this is a FEEDBACK from me! I hope Chess.com can read this and can be true on the next generation of chess.com THANKS
WhiteDrake Nov 3, 2018
Im homeless and need @erik to hire me. To prove myself worthy I will try scrape chess.com My goal is to get the PGN of a game. I know you can just download it but no, I do it the hard way. This is the chess.com game that I will try to scrape. The first game ever on chess.com servers!https://www.chess.com/daily/game/1 I will be using Java and a library called JSOUP. I still have my failed attempt at scraping on Netbeans. It uses JSOUP to gather the HTML document from the webpage and then tries to extract the PGN from it. It seems like I entered a depression episode and deleted all the code associated to getting the PGN tho so I will have to rewrite that. The very simple code to get the HTML document is working. It looks like this: And what I get looks like this when I tell Java to print it out: You will have to zoom on that one but that is the HTML code!! Wait for my next post where I explain my understanding of chess.com´s HTML structure and how I will try to scrape it!
knightburgler Oct 20, 2018
I was testing out my Java son trying to crash it and it seems I crashed something else. https://www.chess.com/club/matches/734460 This match appears as "in_progress" when the two games it has have finished. https://api.chess.com/pub/match/734460 Is this something rare that happens from time to time?
NichtGut Oct 8, 2018
For some users, there are no PGN's in the monthly archive games for 2017/07 Two such cases are: https://api.chess.com/pub/player/propugnator2/games/2017/07 https://api.chess.com/pub/player/walidmujahid/games/2017/07 PGNs for the months before and after the 7th month do seem to exits, though.
Tricky_Dicky Oct 3, 2018
For a very informal test, I ran a script that checks currently just shy of 300 accounts to see if any are closed. Very little disk I/O, just read the list. From api.chess.com, fetch the profile for each account to check the current status. My two tests used the same Wi-Fi(*) access to the same ADSL2+ modem to the same ISP (no VPNs this time around) and from all the way across the Pacific (although in case anything is cached on first lookup, I ran a warm-up). I ran tests on a Rasperry Pi 3B+ (ARM quad-core 1.4Ghz processor) and an older MacBook AIr (i7 processor of some vintage, dual-core, 2Ghz). No significant difference in wall-clock time, as expected. My current belief remains that my scripts wait on responses from api.chess.com, and for any substantial performance improvement at my end I am going to have to cache more aggressively. Wall clock time: ~2 minutes User CPU: ~7s (Raspberry Pi); ~2s (MacBook Air) Kernel CPU: .01-.02s in favour of the MacBook Air. Totally negligible w.r.t. the wall-clock time. The script is single threaded and waits on one response before making the next but retains a HTTP/1.1 SSL connection. This is not a terribly rigorous test, but I was interested to see how the Raspberry Pi handled the task. (I'm considering sitting one on my desk as an "always available" desktop machine which doesn't have either fan noise or disk noise. Back in the day I ran my desktop PC diskless and with an ultra-quiet power supply; I hate computer noise. So yes, I have a neat new toy. ) (*) The Wi-FI I don't think was the limiting factor, although it is only 2.4Ghz "N" and not 5Ghz "ac". I am making do with a second hand ADSL2+ modem I thought for a few weeks, but the Australian National Broadband Network roll-out has been delayed a year where I live. When I used 5Ghz "N" all I noticed was less reported signal strength. What I honestly care about is what content distribution networks make available locally, and after that international bandwidth.
If a program is written to work with different versions of Windows, such as 7, 8 and 10, will it work on a windows server edition ?
Christopher_Parsons Sep 30, 2018
After two weeks of ignoring OOP laws, good coding practices and thread safety I managed to put together a chess.com app designed to help club admins manage their club. It provides information about matches. I decided to share some snapshots of it and the data it processes. I released as a Beta so people think the app is bad because its a beta and not because I dont know how to program in Java. (I definitely know how to, thats why they call me Lil Gosling) If you want to try out here is the link to the .jar file https://github.com/AntonioBohne/Chess.com-ClubManager/releases It basically processes matches. Finished matches, current matches and registered match. Finished Matches Gathers the 10 last matches you played. Shows how many were lost, won and drawn. Displays results your club had with the black and white pieces (how many losses, wins and draws). It also shows you how many matches were lost due to checkmate, resignation and timeouts. It gives you a list with all players that timed out in their games and by just double clicking their name your browser will open the game where they timed out. Current matches Gathers ALL current matches and again shows all the previously mentioned information for both colors. How many losses, wins, draws and how many games are still being played. Also shows the players that have timed out and again, by just double clicking on their name you get sent to their game. (Next update will ban them if you click on their name 3 times). Registered matches Gathers ALL registered matches and shows the average users you have per match vs the average users your opponents have. Also compares average timeout percentage of all matches vs your opponents average timeout percentage. Finally compares the average rating of all matches vs the enemies average rating. You can also filter ALL your players from ALL matches by timeout percentage. If you want to see which players have a timeout percentage bigger than 10% you can also do it! And double clicking on their name will send you to their profile so you can corroborate that horrible 100% timeout percent is not a lie. And here are the snapshots. I tried to use .css blessings to give it a sleek material design feel so that everyone focuses on how good it looks (looks good to me) and not how my code is write only. Initial window Menu (the green letters means the app was able to find the club) Dashboard for finished matches (if you click on a slice it will show its value!) List of players that timed out Dashboard for current matches: 2170 games for each side? That explains why it took a little bit more than a minute to load... Show me the matches you analyzed Java Future matches dashboard Filter players by timeout percentage Two people with a timeout percentage bigger than 30. Nicht GUT! And if you do not want to wait for ALL matches to load just type the match ID. First ever chess.com match... The end
There is a member with the account name "@lph@" (at-lph-at). https://api.chess.com/pub/player/@lph@ This api.chess.com page can’t be found It may have been moved or deleted. HTTP ERROR 410 The player does exist: https://www.chess.com/member/@lph@ While the name is sub-optimal for V3 with the leading "@", api.chess.com should handle it, or if it can't and it's a very big deal to do so, perhaps the member could be persuaded to change the username. The player is using a free account; a few months of a premium account might be a sweetener if a username change is desirable.
A lot of people were asking for it. They wanted something great, something beautiful. Admins all over the world wanted an easy way to manage their Live Matches. Chess.com bureaucracy had added a great feature, live chess matches, but without Nichgut´s help they weren't able to release a JSON API for it. I am still waiting for erik to hire me so I can bring the JSON API for Live Matches to reality, in the meantime I summoned the powers of Java, the powers of beauty, and I came up with a Live Match Manager application for the masses. This app gathers ALL live matches from a certain club and allows you to save them into an Excel sheet. How convenient! I reused the look and feel from my previous Club Manager and implemented a beautifully scraper with JSOUP. Over 3 scraping classes with lots of methods and 4 data objects, all without comments. HOW BEAUTIFUL. The best part, its Open Source, which means you can enjoy it all while I sink into poverty! This one goes for you Richie Stallman! For the ones who dont appreciate my bad attempts at programming jokes here is the app working: For this example I decided to use Team Nicaragua. Since @El_Iniciado was the one that started it all by making a thread about it. If you dont want to gather all 24 matches from Team Nicaragua you can just write "10" for example and the program will gather the 10 most recent matches. If you leave it empty it will analyze ALL matches. Once the information is gathered the "Write Data" button will lightup so that you can select where to save your Excel Sheet Click on it and a beatiful popup will appear: No idea why the menu is in Spanish, my chess.com flag says Im from Deutschland! And finally. Open it and you get this. Tears of joy come out every time I see my creation: You can download the app from here: https://github.com/AntonioBohne/Chess.com-Scraper/releases Big thanks to Ritchie for creating C.
... or something like that. I have written a simple bash script that web-scrapes a player's current published supplement off of an alternate USCF rating lookup page. Any feedback would be appreciated. Link: https://github.com/DarthFloopy/CLI-Chess-Rating-Getter
We currently play a live chess league between national clubs of America, we have: Team Canada, Team USA, Team Mexico, Team Nicaragua, Costa Rica Live Chess, Team Puerto Rico, Team Dominican Republic, Team Venezuela, Team Peru, Ecuador Live Chess, Team Colombia, Argentina Live Chess, Chile Live Chess and Team Brazil Live. Our league is called Live Chess Pan-American League (LCPAL). The tournament format is a double robin hood system (all against all - twice), as in football, roundtrip. Per week each team plays 1 match, in total I have 7 matchs per week, for a duration of 8 1/2 months. Blitz mode 5/2, but next year we will add another time control (10/2 or 3/2, maybe). So, to define the teams' places at the end of each week, we do it in the following order: 1.- Sum of points 2.- If there is a tie of points, we use the Tie Break SB (Sonneborn-Berger) allots each player the total score of the players he defeated, half the score of those he tie, and nothing for the games he lost. 3.- Difference of total points: Points won - points lost, in all its games. Currently all calculations are made with excel formulas. This is an image of the weekly score (example): My wish list would be: 1.- Put the id of the match (every week) and that the system generates the score of the teams. 2.- Do a recalculation of the points of each game, for the closed accounts. 3.- Generate the final report. But, progress is made step by step, so any help in this process would be welcome.
Hi, I have noticed a couple of possible bugs/inconsistencies. This relates to my archive : https://api.chess.com/pub/player/djcaf/games/2018/07 Item #15 which should be for the game https://www.chess.com/daily/game/192749730 My rating was apparently (according to the web site, i.e. not the API) 1354 when the game ended If you download the PGN from the web site then the following ratings are returned: White: 1053 Black: 1354 The PGN data in the returned JSON for this game gives: White: 1071 Black: 1348 That is the first issue (inconsistency). Also in the JSON there are two fields for this game: White and Black. Under each is the rating; In this case; White > Rating: 1053 Black > Rating: 1354 Those match the rating after the game has been completed. The documentation (https://www.chess.com/news/view/published-data-api#pubapi-endpoint-games-archive) suggests those should be the rating at the start of the game. I am no bothered which way that works, but it seems that this is also an inconsistency. Thanks
Hey all, I just finished up this little app to visualize all of your chess games from chess.com. It provides info on opening frequency and piece counts per move for each game in an easy to digest series of graphs. Hope you give it try and give some feed back on what you would like to see more of! (ps. it might be a tad slow if you have a lot of games > 2000, so you might have to be patient, I'm currently working on improving performance) https://github.com/Bmcgarry194/chessvision Here is a gif of the app in action: