WinShopAPI docs
Reference

Product

Create a product

Creates a product together with the child collections present in the body (barcodes, units, suppliers, variants, …) and returns the stored product with everything loaded (201, `Location` header set). Read-only fields in the body are ignored rather than rejected. Requires `Permissions.Product.Create`.

Get the variant matrix for expedition

Returns the variant grid a warehouse can actually despatch: the catalogue's variants joined with what is on stock, so cells that exist in the catalogue but hold nothing are still reported. `warehouseId` is required. Requires `Permissions.Product.View`.

Get the selling price of several products

Same resolution as `GET {productId}/price`, for up to 50 products in one call. Takes no variant parameters, so it prices each product at its base variant. Requires `Permissions.Product.View`.

Get several products

Returns the products listed in `productIds`, each shaped by the `details` sub-queries. Prefer this over looping `GET {productId}` when you already know the whole set of ids. Requires `Permissions.Product.View`.

Reserve a product id

Reserves the next free product id and returns it, so a caller can build the product's barcodes and references before sending the product itself. Requires `Permissions.Product.Create`.

Get the variant matrix of several products

Returns, for each product in `productIds`, the grid of its colour/size/length/dimension variants with the quantity available in each cell. Requires `Permissions.Product.View`.

Get the variant matrix for one warehouse

Same grid as `GET variants-availability-matrix`, restricted to the stock held in `warehouseId`. `warehouseId` is required. Requires `Permissions.Product.View`.

Get a product

Returns one product by `productId`. Use `details` to pick which sub-collections (barcodes, units, variants, …) are loaded; omit it for the header only, which is much cheaper. Requires `Permissions.Product.View`.

Delete a product

Deletes the product with its child collections and returns 204. Cannot be undone. Call `GET {productId}/check-delete` first to find out whether the delete is allowed. Requires `Permissions.Product.Delete`.

Update a product

Updates the product and the child collections present in the body, then returns the stored product with everything loaded. Collections the body leaves out are untouched. Requires `Permissions.Product.Update`.

List a product's attachments

Returns the attachments of the product with their metadata, without the file contents. Requires `Permissions.Product.View`.

Upload a product attachment

Adds an attachment to the product. Requires `Permissions.Product.Update`.

Get a product attachment

Returns one attachment including its file contents. Requires `Permissions.Product.View`.

Delete a product attachment

Removes the attachment from the product and returns 204. Cannot be undone. Requires `Permissions.Product.Update`.

List a product's barcodes

Returns every barcode registered for the product. Requires `Permissions.Product.View`.

Create a product barcode

Registers a barcode for the product and returns it (201, `Location` header set). Requires `Permissions.Product.Create`.

Get a product barcode

Returns one barcode of the product. 404 when `barcodeId` does not belong to `productId`. Requires `Permissions.Product.View`.

Update a product barcode

Replaces one barcode of the product and returns the stored row. Requires `Permissions.Product.Update`.

Get a product's building-material data

Returns the building-material attributes of the product, or nothing when it carries none. Requires `Permissions.Product.View`.

Delete a product's building-material data

Removes the building-material attributes from the product and returns 204. Requires `Permissions.Product.Update`.

Update a product's building-material data

Creates or replaces the product's building-material attributes and returns the stored row. Requires `Permissions.Product.Update`.

Check whether a product can be deleted

Advisory pre-flight for `DELETE {productId}`. `canBeDeleted` is false when `blockingReferences` lists the places that still point at the product (stock rows, documents, …). Requires `Permissions.Product.View`.

List a product's read-only fields

Returns the fields of this product that the instance's configuration will not let you change, so a client can disable them before the user edits anything. Which fields are locked is instance-specific. Requires `Permissions.Product.View`.

Get a product photo

Returns the image in slot `photoNumber` as raw bytes with its own content type. `width`, `height`, `quality` and `format` re-encode the stored image on the fly, so a client can request exactly the thumbnail it needs. 404 when the slot is empty. Requires `Permissions.Product.View`.

Upload a product photo

Stores the image in the requested photo slot, replacing whatever that slot held. Requires `Permissions.Product.Update`.

Delete a product photo

Empties the photo slot given by `photoNumber` and returns 204. Requires `Permissions.Product.Update`.

List a product's photos

Returns the photo slots of the product with their metadata. Fetch the image bytes themselves from `GET {productId}/photo`. Requires `Permissions.Product.View`.

Get the selling price of one product

Resolves the selling price of one product variant for a given warehouse, and optionally a customer, applying the price lists, discounts and promotions that the instance has configured. The `is*` flags say which kind of document the price is being quoted for, because a price can differ between a sale, an order and an e-shop basket. Requires `Permissions.Product.View`.

Get a purchase price from a supplier

Returns the purchase price agreed with `supplierId` that is valid on `priceDate`. Requires `Permissions.Product.View`.

List a product's repricings

Returns the repricing rows recorded for this product, optionally narrowed to those effective between `validFromStart` and `validFromEnd`. See the *ProductRepricing* endpoints to create one. Requires `Permissions.Product.View`.

Run a custom product statistic

Runs the custom statistic registered under `routeName` for this product and returns its rows. Which routes exist is instance-specific, configured in the database rather than in this API; 404 when `routeName` is not one of them. Requires `Permissions.Product.View`.

List a product's supplier terms

Returns the per-supplier purchasing terms for this product (purchase price, lead time, minimum order and the like). Requires `Permissions.Product.View`.

Create supplier terms

Adds a supplier's purchasing terms for this product and returns them (201, `Location` header set). Requires `Permissions.Product.Create`.

Get one supplier's terms

Returns one supplier's purchasing terms for this product. 404 when it does not belong to `productId`. Requires `Permissions.Product.View`.

Update supplier terms

Replaces one supplier's purchasing terms for this product and returns the stored row. Requires `Permissions.Product.Update`.

List a product's supplier codes

Returns the codes each supplier uses for this product. Requires `Permissions.Product.View`.

Create a supplier code

Adds a supplier's own code for this product and returns it (201, `Location` header set). Requires `Permissions.Product.Create`.

Get a supplier code

Returns one supplier code of the product. 404 when it does not belong to `productId`. Requires `Permissions.Product.View`.

Update a supplier code

Replaces one supplier code of the product and returns the stored row. Requires `Permissions.Product.Update`.

List a product's units

Returns the units of measure defined for the product, with the conversion each one applies to the base unit. Requires `Permissions.Product.View`.

Create a product unit

Adds a unit of measure to the product and returns it (201, `Location` header set). Requires `Permissions.Product.Create`.

Delete a product unit

Removes one unit of measure from the product and returns 204. Requires `Permissions.Product.Update`.

Update a product unit

Replaces one unit of measure of the product and returns the stored row. Requires `Permissions.Product.Update`.

List a product's user-group memberships

Returns the user groups this product belongs to. User groups drive which users and price rules reach the product, and the groups themselves are instance-specific. Requires `Permissions.Product.View`.

Add a user-group membership

Adds the product to a user group and returns the new membership (201, `Location` header set). Requires `Permissions.Product.Create`.

Replace all user-group memberships

Replaces the product's whole set of user-group memberships with the list in the body, then returns the resulting set. Memberships the body leaves out are removed. Requires `Permissions.Product.Update`.

Remove a user-group membership

Removes the product from one user group and returns 204. Requires `Permissions.Product.Update`.

Get the variant matrix of one product

Returns the grid of one product's colour/size/length/dimension variants with the quantity available in each cell. Requires `Permissions.Product.View`.

Get one product's matrix for one warehouse

Returns one product's variant grid restricted to the stock held in `warehouseId`, which is required. Requires `Permissions.Product.View`.