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" } ]

Add parameter `nested=true` to get all parts that are nested below these parts, to get the full tree of parts. Full url: https://example.picqer.com/api/v1/products/{idproduct}/parts?nested=true For each "virtual_composition", it will give a "parts" key with an array of all parts below.

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

Register production

You can run production to keep stock levels up for composition products.

POST https://example.picqer.com/api/v1/products/{idproduct}/produce
{ "idwarehouse": 67, "amount": 3, "reason": "New production at table 2" }
HTTP/1.1 204 No Content
Read more Orders