I’ve de­com­mis­sioned Antonio; it was re­ally only used briefly. You can still ac­cess the repos­i­tory at Github.

If you’re into de­signer board games (you should be!) and you’re on­line (…you are!), then you’re prob­a­bly aware of BoardGameGeek, which is the board game web­site, where afi­ciona­dos dis­cuss, trade, and cel­e­brate all things board gam­ing.

Recently, a fel­low named Scott Jaworski asked if there’s a way to find a list of board games he could get in a trade if he traded one of his away. BGG does­n’t sup­port this func­tion­al­ity, and it sounded like an in­ter­est­ing and easy pro­ject, so I went ahead and did it. Meet Antonio. Here’s how he was formed:

Most of the nec­es­sary data is availalbe from the BGG API. Rather than us­ing the of­fi­cial BGG XML API di­rectly, I de­cided to use E. Strathmeyer’s JSON API, which is built upon the for­mer. I con­sid­ered a dif­fer­ent JSON API, but it was down when I started cod­ing. Maybe next time.

One item not pro­vided is the list of users that want to trade for a game. So, I wrote my own API. Having never writ­ten a web API ser­vice, I started re­search­ing tech­nolo­gies. The best op­tion looked to be an ASP.NET Web API, so I read some of the Microsoft tu­to­ri­als and got started. The API it­self was sur­pris­ingly easy to set up, as was de­ploy­ing to Azure. I used HTMLAgilityPack and Fizzler, which made screen scrap­ing eas­ier than ex­pected. In fact, while I ex­pected this to be the most dif­fi­cult piece of the puz­zle, it turned out to be one of the eas­i­est.

I did get tripped up by CORS, cross-ori­gin re­source shar­ing. This had to be en­abled so I could call my API from a web page. Once I iden­ti­fied the prob­lem it was not dif­fi­cult to fix.

Next I set up a sim­ple web page, grabbed jQuery, and started writ­ing the client-side por­tion of Antonio. This por­tion took the most time, and had some chal­lenges of it’s own, a cou­ple of which were solved by new-to-me fea­tures: the ap­ply func­tion and promises.

One dis­ap­point­ment was that, while you can get the games a user wants to trade from BGGs API, you can’t get it on de­mand. The data has to be gen­er­ated, which in my ex­pe­ri­ence takes up to 24 hours. My so­lu­tion was to dis­play a list of users whose data is be­ing gen­er­ated, but it’s an­noy­ing that a user could type a game into Antonio and then have to wait un­til the next day, come back to the page and search for the game again. Oh well.

Antonio was a fun pro­ject to write, and I learned a good bit about .NET and JavaScript to boot. Check it out, and let me know if you have any ques­tions about any­thing. You can see all the code at Github. If you ex­pe­ri­ence prob­lems, you can con­tact me, open an is­sue on the Github pro­ject, or re­ply to my post about Antonio on BGG.