Register(FREE)   Login

REST LEGO® API - Public API description

Cubiculus > API > Description
Here are described exposed methods. Method are accessible with REST and HTTP requests. In following text you'll find described exposed methods their parameter and meaning. Technical background of API methods described here.
If some information is missing or you have some question contact us.

Quick reference

/building-instructions/{apiKey}get list of available LEGO® building instructions
/building-instructions/{apiKey}/{id}Get information about one LEGO® building instruction.
/user-by-email/{apiKey}/{email}Perform login operation. After authorization provide users account informations.
/lego-set/{apiKey}/{legoSetNo}Get detail informations about LEGO® set.
/collection/{apiKey}Collection management. Require HTTP basic authentication.
/range-year/{apiKey}Provide information about possible release year limitation for selected LEGO® sets.
/range-price/{apiKey}Provide information about possible price limitation for selected LEGO® sets.
/properties/{apiKey}Return list of properties and property values that belongs to some selection.
/lego-sets/{apiKey}Return list of LEGO® that belongs to some property values.

/building-instructions/{apiKey}

get list of available LEGO® building instructions

Parameters

apiKeyAssigned application key

HTPP method GET

Allows to get full list of available building instructions

Example URL

					
GET http://www.cubiculus.com/api-rest/building-instruction/{apiKey}
							
				

HTTP result code - 200

Data are successfully send.
				
[
   {
      "description" : "137",
      "idInstruction" : 1,
      "name" : "137",
      "shortcutPicture" : "http://www.cubiculus.com/original/0137/TN_01379.JPG",
      "stepGroups" : null
   },
   {
      "description" : "Curved Track",
      "idInstruction" : 2,
      "name" : "151",
      "shortcutPicture" : "http://www.cubiculus.com/original/0151/TN_01511.JPG",
      "stepGroups" : null
   },
   {
      "description" : "London Bus",
      "idInstruction" : 3,
      "name" : "313",
      "shortcutPicture" : "http://www.cubiculus.com/original/0313/TN_031311.JPG",
      "stepGroups" : null
   }]
   
					

/building-instructions/{apiKey}/{id}

Get information about one LEGO® building instruction.

Parameters

apiKeyAssigned application key
idIdentification number of building instruction

HTPP method GET

Get detail informations about one building instruction.

Example URL

					
GET http://www.cubiculus.com/api-rest/building-instruction/{apiKey}/300
					
				

HTTP result code - 200

Data are successfully send.
				
{
   "description" : "Crater Crawler",
   "idInstruction" : 250,
   "name" : "6826",
   "shortcutPicture" : "http://www.cubiculus.com/original/6826/TN_682601.JPG",
   "stepGroups" :
      [
         {
            "fileNames" :
               [
                  "http://www.cubiculus.com/original/6826/682602.JPG",
                  "http://www.cubiculus.com/original/6826/682603.JPG",
                  "http://www.cubiculus.com/original/6826/682604.JPG",
                  "http://www.cubiculus.com/original/6826/682605.JPG",
                  "http://www.cubiculus.com/original/6826/682606.JPG",
                  "http://www.cubiculus.com/original/6826/682607.JPG",
                  "http://www.cubiculus.com/original/6826/682608.JPG"
               ],
            "name" : "Crater Crawler"
         },
         {
            "fileNames" :
               [
                  "http://www.cubiculus.com/original/6826/682610.JPG",
                  "http://www.cubiculus.com/original/6826/682611.JPG",
                  "http://www.cubiculus.com/original/6826/682612.JPG",
                  "http://www.cubiculus.com/original/6826/682613.JPG"
               ],
            "name" : "fly"
         },
         {
            "fileNames" :
               [
               ],
            "name" : "crew"
         }
      ]
}				

					

HTTP result code - 404

There is no such LEGO® building instruction.

/user-by-email/{apiKey}/{email}

Perform login operation. After authorization provide users account informations.

Parameters

apiKeyAssigned application key
emailUser identifying email.

HTPP method GET

Get detail informations about one user. Also prove that login name and passwords are correct. Method require BASIC AUTH HTTP authorization system. Please look at the example code. There are detail working example.

Example URL

					
GET http://www.cubiculus.com/api-rest/user-by-email/{apiKey}/somebody@somewhere.com
					
				

HTTP result code - 200

Data are successfully send.
				
{
   "birthDate" : "2006-01-01T01:00:00.000",
   "email" : "somebody@somewhere.com",
   "idImageIcon" : 234,
   "idUser" : 304,
   "lastLogin" : "2009-07-22T09:50:01.000",
   "registrationDate" : "2009-07-22T09:50:01.000",
   "userName" : "somebody"
}

					

HTTP result code - 401

The request requires user authentication. Please provide correct email and password values.

HTTP result code - 404

There is no such LEGO® building instruction.

/lego-set/{apiKey}/{legoSetNo}

Get detail informations about LEGO® set.

Get detail information about LEGO® set

Parameters

apiKeyAssigned application key
legoSetNoLEGO® set number that identify each LEGO® set. Please note that this is related to number that appears at each LEGO® box.

HTPP method GET

Provide detail informations about LEGO® set

Example URL

					
GET http://www.cubiculus.com/api-rest/lego-set/{apiKey}/10187
					
				

HTTP result code - 200

Data are successfully send to API user. Service could return more than one LEGO® set descriptions. This happens in case that two distinct LEGO® set have same number.
				
[
   {
      "boxNo" : "10187",
      "description" : "Super car",
      "idLastImageRevision" : null,
      "idLastRevision" : 89,
      "idLegoBox" : 3,
      "idLegoCategory" : 28,
      "idLegoModel" : 1,
      "imageUrl" : "http://www.cubiculus.com/images/320?w=320&h=200",
      "legoModelName" : "Volkswagen Beetle",
      "modelImageUrl" : "http://www.cubiculus.com/images/2?w=320&h=200",
      "images" :
         [
            "http://www.cubiculus.com/images/5307?w=320&h=200",
            "http://www.cubiculus.com/images/5308?w=320&h=200",
            "http://www.cubiculus.com/images/5309?w=320&h=200",
            "http://www.cubiculus.com/images/5310?w=320&h=200"
         ],
      "name" : "Volkswagen Beetle II",
      "pieces" : 1626,
      "price" : 150,
      "released" : 2008,
      "separator" : null,
      "url" : "10187"
   }
]				
					

HTTP result code - 404

There is no such LEGO® set.

/collection/{apiKey}

Collection management. Require HTTP basic authentication.

Parameters

apiKeyAssigned application key

HTPP method GET

Require authorization.

Example URL

					
GET http://www.cubiculus.com/api-rest/collection/{apiKey}/9/
					
				

HTTP result code - 200

Data are successfully send.
				
{
   "items" :
      [
         {
            "comment" : null,
            "idLegoSet" : 5,
            "quantity" : 1
         }
      ]
}				
				
					

HTTP result code - 404

There is no such user.

HTPP method POST

Allows to save change in user's LEGO collection. When user want to remove item than save it in quantity 0.

Example URL

				
POST http://www.cubiculus.com/api-rest/collection/{apiKey}/9/

POST data:					
{
   "comment" : null,
   "idLegoSet" : 1,
   "quantity" : 8
}
				
				

HTTP result code - 200

Data are successfully stores.
				
"OK"				
					

/range-year/{apiKey}

Provide information about possible release year limitation for selected LEGO® sets.

It's return maximal and minimal releases year LEGO® sets for given selection. Selection id specified by list of property value ids.

Parameters

apiKeyAssigned application key
bodyHTTP request body contains list of property values ids

HTPP method POST

Provide possible range

Example URL

					
POST http://www.cubiculus.com/range-year/{apiKey}
					
POST data:
[]
					
				

HTTP result code - 200

Data are successfully send.
				
{
   "from" : "1964",
   "to" : "2012"
}
				
					

/range-price/{apiKey}

Provide information about possible price limitation for selected LEGO® sets.

It's return maximal and minimal price of LEGO® sets for given selection. Selection id specified by list of property value ids.

Parameters

apiKeyAssigned application key
bodyHTTP request body contains list of property values ids

HTPP method POST

Provide possible range.

Example URL

					
POST http://www.cubiculus.com/api-rest/range-year/{apiKey}
					
POST data:					
[]
				
				

HTTP result code - 200

Data are successfully send.
				
{
   "from" : "0",
   "to" : "400"
}
				
					

/properties/{apiKey}

Return list of properties and property values that belongs to some selection.

Method allows show tree like structure for selecting categories.

Parameters

apiKeyAssigned application key
bodyHTTP request body contains list of property values ids and optionally price or released year range.

HTPP method POST

Provide possible range.

Example URL

				
POST http://www.cubiculus.com/api-rest/properties/{apiKey}

POST data:					
{
   "idPropertyValues" :
      [
         34,
         55,
         33
      ],
   "priceRange" :
      {
         "from" : 3,
         "to" : 40
      },
   "yearRange" :
      {
         "from" : 1998,
         "to" : 2012
      }
}
				
				

HTTP result code - 200

Data are successfully send.
				
[
   {
      "idProperty" : 1,
      "name" : "Price",
      "values" :
         [
            {
               "count" : 325,
               "idPropertyValue" : 3,
               "name" : "from $0 up to $10",
               "webName" : "from-0-to-10"
            },
            {
               "count" : 601,
               "idPropertyValue" : 4,
               "name" : "from $10 to $50",
               "webName" : "from-10-to-50"
            },
            {
               "count" : 124,
               "idPropertyValue" : 5,
               "name" : "from $50 up to $100",
               "webName" : "from-50-to-100"
            },
            {
               "count" : 59,
               "idPropertyValue" : 6,
               "name" : "more than $100",
               "webName" : "more-than-100"
            }
         ]
   },
   {
      "idProperty" : 4,
      "name" : "No of bricks",
      "values" :
         [
            {
               "count" : 44,
               "idPropertyValue" : 9,
               "name" : "No information",
               "webName" : "no-value2"
            },
            {
               "count" : 533,
               "idPropertyValue" : 12,
               "name" : "big",
               "webName" : "big"
            }
         ]
   },
   {
      "idProperty" : 2,
      "name" : "Sets with building instructions",
      "values" :
         [
            {
               "count" : 34,
               "idPropertyValue" : 7,
               "name" : "Sets with building instructions",
               "webName" : "with-bi"
            }
         ]
   }
]				
					

/lego-sets/{apiKey}

Return list of LEGO® that belongs to some property values.

Get one page from LEGO® sets that belongs belongs to given property values and returned LEGO® sets could be limited by given tange.

Parameters

apiKeyAssigned application key
bodyHTTP request body contains list of property values ids and optionally price or released year range.

HTPP method POST

Provide possible range.

Example URL

				
POST http://www.cubiculus.com/api-rest/lego-sets/{apiKey}

POST data:					
{
   "currentPageNo" : 1,
   "propertiesParams" :
      {
         "idPropertyValues" :  [],
         "priceRange" :
            {
               "from" : "0",
               "to" : "1000"
            },
         "yearRange" :
            {
               "from" : "1998",
               "to" : "2012"
            }
      },
   "rowPerPage" : 20
}				
				
				

HTTP result code - 200

Data are successfully send.
				
{
   "asc" : false,
   "base" : 0,
   "currentPage" :
      [
         {
            "avgRating" : 0,
            "boxNo" : "5538",
            "description" : null,
            "idBoxImage" : null,
            "idBuildingInstruction" : null,
            "idLegoBox" : 34,
            "image" : "http://www.cubiculus.com/images/396",
            "imageExtension" : null,
            "link" : "http://www.cubiculus.com/lego-set/lego/34",
            "name" : "LEGO DUPLO Creativ Bucket",
            "pieces" : null,
            "price" : null,
            "released" : null,
            "separator" : null,
            "tags" : null
         },
         
 		...
 		
         {
            "avgRating" : 0,
            "boxNo" : "5638",
            "description" : null,
            "idBoxImage" : null,
            "idBuildingInstruction" : null,
            "idLegoBox" : 56,
            "image" : "http://www.cubiculus.com/images/440",
            "imageExtension" : null,
            "link" : "http://www.cubiculus.com/lego-set/lego/56",
            "name" : "Postman",
            "pieces" : null,
            "price" : null,
            "released" : null,
            "separator" : null,
            "tags" : null
         }
      ],
   "currentPageNo" : 1,
   "currentPageSize" : 20,
   "currentPageStartRecordNo" : 20,
   "orderBy" : null,
   "pageCount" : 56,
   "rowCount" : 1111,
   "rowPerPage" : 20
}
				
					
LEGO® is a trademark of the LEGO® Group, which does not sponsor, authorize or endorse this web site.
© cubiculus.com, All rights reserved.