New version of Brickset API now available

Posted by ,

We've offered an application programming interface (API) to Brickset's database for some time and a number of excellent apps for mobile platforms have been developed as a result.

The current version is based on XML, so is a bit clunky and hard to use, but this week I finally found the time to update it to provide responses in JSON which should make it much easier to digest.

So, version 3 of the API is now live and, thanks to valuable help and feedback from RikTheVeggie (author of MyBrickset for Android), I think it's now ready for widespread use.

There may still be a few bugs, and a few minor changes that need to be made, but if you're looking for a software development project to occupy yourself while you're holed up, take a look at the documentation, request an API key and get started!

I look forward to seeing what you come up with...

Version 2 of the API will be retired at the end of October so if you're an existing user please update your app/website/program as soon as you can. Thanks!

30 comments on this article

Gravatar
By in Canada,

I hope it has "Sort by last added to collection" feature, which is the main thing I'm missing from the excellent "MyBrickset" app!

Gravatar
By in United States,

Nice! Thanks for continuing to support/provide this feature.

Gravatar
By in United States,

Excellent! Was just starting to look into the API recently

Gravatar
By in Singapore,

Sorry, I am a bit confused on how you download/update the new software. the link above 'version 3 of the API' takes me to this page with a list of links like set collection, and I can't find the 'update' or 'download' button anywhere. Can somebody explain how it works?

Gravatar
By in Ireland,

@charleslegoguy said:
"Sorry, I am a bit confused on how you download/update the new software. the link above 'version 3 of the API' takes me to this page with a list of links like set collection, and I can't find the 'update' or 'download' button anywhere. Can somebody explain how it works?
"

An API is not a piece of software you download. If you write your own software, the API is how you would connect with Brickset.
https://en.wikipedia.org/wiki/Application_programming_interface

Gravatar
By in Israel,

@elangab said:
"I hope it has "Sort by last added to collection" feature, which is the main thing I'm missing from the excellent "MyBrickset" app! "

Doesn't look like it, from the documentation:
Specify sort order.
Valid values are Number, YearFrom, Pieces, Minifigs, Rating, UKRetailPrice, USRetailPrice, CARetailPrice, EURetailPrice, Theme, Subtheme, Name, Random.

Gravatar
By in United States,

Wonderful to hear. Thanks for your hard work!

Gravatar
By in United States,

Oh! Neat!

Still hoping to release my iOS app...someday. ??

Gravatar
By in Canada,

It's been fun collaborating with you Huw, and thanks for the shout out :D

The new JSON based API certainly seems a lot easier to work with than the old XML one, and I've always been a fan of strongly typed interfaces!

Combined with the efficiencies you've introduced by reworking & replacing some of the calls, there hasn't been a better time for people to come up with new apps etc that integrate to Brickset.

I hope this will inspire more people to pick up a keyboard and write something, even if it's just a personal project so they can learn a new programming language (that's where myBrickset came from!).

Gravatar
By in United States,

This is very cool. Is there a list somewhere of current apps that take advantage of the API?

Gravatar
By in Serbia,

Yes, JSON! Thank you for this update! I think now I'll rewrite the small "set info" section on my blog. ;)

Gravatar
By in Germany,

I am by no means a programming expert but I am happy I read the article anyway because it made me aware of the MyBrickset app which I had never heard of before. Just downloaded it and already am mighty impressed by it. Excellent work @RikTheVeggie!

Gravatar
By in Hungary,

Thank you for letting me know, what the Active Pharmaceutical Ingredient means here.

Gravatar
By in France,

huh?

Gravatar
By in United Kingdom,

@B_Space_Man said:
"This is very cool. Is there a list somewhere of current apps that take advantage of the API?"

https://brickset.com/tools/mobileapps

There should be more listed, but there isn't, because I've lost track. The new API will make it easier to determine who is doing what with it and thus, I hope, easier to maintain that list.

Gravatar
By in United Kingdom,

@elangab said:
"I hope it has "Sort by last added to collection" feature, which is the main thing I'm missing from the excellent "MyBrickset" app! "

The actual date is not recorded (since doing so for 24 million records would inflate the database considerably) but the order you added them can be determined from their record ID, which increments as records are added, of course.

It's actually possible to to that already but it's not noted in the documentation, so I'll add it.

Gravatar
By in Turkey,

By the way the new captcha is really bad! I have to try nearly 3 times to enter site!

Gravatar
By in United Kingdom,

I've relaxed the settings for users in Turkey. Hopefully it's better now.

Gravatar
By in Turkey,

@Huw said:
"I've relaxed the settings for users in Turkey. Hopefully it's better now."

Thank you Huw. I'm waiting for next captcha session for reporting :)

Gravatar
By in Viet Nam,

Where is v3 of API? I checked the link above and it still returns XML data!

Gravatar
By in Canada,

@Huw said:
" @elangab said:
"I hope it has "Sort by last added to collection" feature, which is the main thing I'm missing from the excellent "MyBrickset" app! "

The actual date is not recorded (since doing so for 24 million records would inflate the database considerably) but the order you added them can be determined from their record ID, which increments as records are added, of course.

It's actually possible to to that already but it's not noted in the documentation, so I'll add it."

Thanks for explaining ! (and @Nivst thanks as well!)

Gravatar
By in United Kingdom,

Yes. That way I can tell which old keys are still in use before switching v2 off.

Gravatar
By in Israel,

Anyone else getting long response time intermittently?
A simple getSets query that takes less than a second can take up to 20 occasionally.

Gravatar
By in Germany,

With API v3 there is no method "getSet" (Retrive full information about one set) to get these special fields (tags, notes, description...)

Gravatar
By in Israel,

@Lebostein said:
"With API v3 there is no method "getSet" (Retrive full information about one set) to get these special fields (tags, notes, description...)"

Notes are listed once you provide a userHash, just tested that one.

Gravatar
By in Germany,

@Nivst said:
" @Lebostein said:
"With API v3 there is no method "getSet" (Retrive full information about one set) to get these special fields (tags, notes, description...)"

Notes are listed once you provide a userHash, just tested that one."

I mean not the UserNotes! I mean the normal set notes from the database... look at the article screenshot. There is a field "notes" and a field "tags" at the end of the json. I get these fields with API V2 + getSet, but not with API V3 + getSets. If I use the API to get information about the set 21322 I get this only:

{"status":"success","matches":1,"sets":[
{
"setID": 30036,
"number": "21322",
"numberVariant": 1,
"name": "Pirates of Barracuda Bay",
"year": 2020,
"theme": "Ideas",
"themeGroup": "Miscellaneous",
"pieces": 2545,
"image": true,
"thumbnailURL": " https://images.brickset.com/sets/small/21322-1.jpg ",
"imageURL": " https://images.brickset.com/sets/images/21322-1.jpg ",
"bricksetURL": " https://brickset.com/sets/21322-1 ",
"released": false,
"wantedByTotal": 2072,
"rating": 0.0,
"packagingType": "Box",
"availability": "Retail - limited",
"instructionsCount": 0,
"additionalImageCount": 71,
"ageMin": 16,
"category": "Normal",
"lastUpdated": "2020-03-27T17:18:34.103Z"
}
]}

As you can see, the fields "notes" and "tags" are not listed....

Gravatar
By in United Kingdom,

As mentioned in the forum, pass a set ID to get the extended fields.

Gravatar
By in Germany,

seems you made significant changes to "year" and "USDateRemoved" fields. 1. Now they are called dateRemovedFromLEGOdotComUSA and dateAddedToLEGOdotComUSA. 2. some values are mysqldate formatted and some just yyyy. Can you confirm this please in order that everyone gets update? thanks! btw: i like that update. more clear and detailled.

Gravatar
By in Germany,

The old API will be switched off in October. Can you say when the new API will be ready for use (May/June/July)?

Return to home page »