Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 1.82 KB

README.md

File metadata and controls

72 lines (52 loc) · 1.82 KB

Java Brickset API

Maven Central

Java API for Brickset webservices API v3.

See https://brickset.com/article/52666/brickset-web-services for more information about the official Brickset API

Support all methods (version 1.04, 04 Feb 2021):

  • General
  • Sets
  • Set collection management
  • Minifig collection management

Basic cases

Create an instance:

IBricksetService service = new BricksetServiceImpl("myApiKey");

Retrieve the userhash if not already known and if needed:

try {
	String userhash = service.login("mylogin", "mypwd");
	// You may check the userhash
	service.checkUserHash(userhash);
	.
	.
	.
} catch (BricksetException e) {
	System.err.println(e.getCodeMessage() + ": " + e.getMessage());
}

Looking for a particular set:

SetParameters params = new SetParameters();
// Look for set number 60132
params.addSetNumber("60132-1");
List<Set> sets = service.getSets(params);
if (!sets.isEmpty()) {
	Set set = sets.get(0);
} 

Using different criterias to query:

SetParameters params = new SetParameters();
// Look for all the sets in themes Architecture and Classic, year 2020, ordered by number of pieces desc.
params.addTheme("Architecture").addTheme("Classic").addYear("2020").setOrderBy(OrderByEnum.PiecesDESC);
List<Set> sets = service.getSets(params);

Check IBricksetService to see the full list of methods, including collection management.

Unit tests

To run the tests, you need to create a parameters.properties in test resources with the following properties :

apikey=
userhash=
login=
password=

Caution, CollectionManagement tests may alter your Brickset collection. Check what you are doing before!