× Welcome Introduction GET Requests Understanding XML More Requests Final Thoughts

More Requests

Requesting multiple things

To request multiple things, separate the ID numbers with commas:


You should see that in this XML document, there are two of the main <item> tags - one for each board game. We can write some quick code to print out the name of both of those games:

The results will look like this:

Two Games Displayed

Requesting a user's game collection

There are a lot of parameters that you can add when requesting a user's collection. In this example, I've use some of the more common ones. The format for longer requests like this is as follows: the first parameter you list follows a ? (question mark), and each subsequent parameter follows an & (ampersand).


An interesting thing to note, is what happens after you send a request for a collection. Once a request is sent, the servers must catalog the items in a users collection, meaning your request won't be sent back right away. Instead, you will see something like this:

Message Displayed

Once the log has been completed, you can run the query again and will receive the XML back. Unfortunately, there is no way to know how long it will take for that query to come back. If you get a 202 status code back, then it indicates BGG has queued your request and you need to keep retrying until you no longer get a 202 status code. You only have to ask for the log to be generated once. A new log won't be needed again unless the user changes their collection. If you want to parse the data to display the items in a users collection, you can do something like this:

The result will look like this:

Collection Displayed

And here's what the actual collection looks like on BGG:

Taylor's Collection Displayed

Finding what's hot

You can easily see what the "hottest" things are on the 'Geek using the a variant of the following request:


Here's another quick script showing how you could utilize that XML to grab what's hot quickly:

Here's what the result would look like:

What's Hot Displayed

And here's where you would normally see that list on BGG's front page:

Hotness Displayed

Doing a search

Without changing our last code snippet, we can actually do a search for games that match a specific criteria. For example, if we want to find all boardgames with 'dog' in the title, we can do the following:


Without changing our code, we'll get the following back:

Dog Search Displayed