Product composition and parts

See also documentation for products.

Picqer has 4 types of products:

  • normal
  • unlimited stock
  • virtual composition
  • composition with own stock

The types with compositions can have parts and all products can be part of a composition. You can even have compositions as part of another composition for nested sets.

Example composition

A composition or 'set' of products is for example a tennis racket and a set of tennis balls. You will have 3 products:

  • Tennis racket (normal product)
  • Box of 3 tennis balls (normal product)
  • Set of tennis racket and a box of 3 tennis balls (virtual composition, with the 2 above products as parts)

Get parts of a product

If a product is a composition, you can retrieve its parts.

GET https://example.picqer.com/api/v1/products/{idproduct}/parts
HTTP/1.1 200 OK [ { "idproduct_part": 3, "idproduct": 64, "amount": 1, "productcode": "AA388046", "name": "Sony Standard Tripple", "type": "normal" }, { "idproduct_part": 4, "idproduct": 228, "amount": 1, "productcode": "abl006", "name": "Classic Hardshell Suitcase 21 inch", "type": "normal" } ]

Get single product part

GET https://example.picqer.com/api/v1/products/{idproduct}/parts/{idproduct_part}
HTTP/1.1 200 OK { "idproduct_part": 3, "idproduct": 64, "amount": 1, "productcode": "AA388046", "name": "Sony Standard Tripple", "type": "virtual_composition" }

Add a part to a product

POST https://example.picqer.com/api/v1/products/{idproduct}/parts
{ "idproduct": 5, "amount": 2 }
HTTP/1.1 201 Created { "idproduct_part": 7, "idproduct": 5, "amount": 2, "productcode": "KEJKCH938", "name": "Philips Recorder 2928", "type": "normal" }

Update amount of parts

You can only update the amount of parts that is included in the composition.

PUT https://example.picqer.com/api/v1/products/{idproduct}/parts/{idproduct_part}
{ "amount": 3 }
HTTP/1.1 200 OK { "idproduct_part": 7, "idproduct": 5, "amount": 3, "productcode": "KEJKCH938", "name": "Philips Recorder 2928", "type": "normal" }

Delete a product part

DELETE https://example.picqer.com/api/v1/products/{idproduct}/parts/{idproduct_part}
HTTP/1.1 204 No Content