Skip to content

Products ​

A product is an item sold by the grocery. The API lets you list, read, create, update and delete it.

What you can do ​

ActionRequestWho uses it today
List all productsGET /api/products/the web's / page
Read one productGET /api/products/{id}/nobody (available)
Create a productPOST /api/products/the web's add form
Replace a productPUT /api/products/{id}/nobody (available)
Update part of itPATCH /api/products/{id}/nobody (available)
Delete a productDELETE /api/products/{id}/the web's Delete button

The details of each endpoint are in the Reference.

Business rules ​

  • The name is required and at most 120 characters.
  • The price is in euros, with two exact decimals. It cannot be negative. A price of 0 is accepted (free product).
  • The stock is a non-negative integer. If not sent, it is 0.
  • The description is free and may stay empty.
  • The id and dates are managed by the API. Those sent by the client are ignored.
  • The list is always sorted by id, so by creation order.

Data that breaks these rules is refused with a 400: see Errors and validation.

What does not exist yet ​

MissingConsequence
AuthenticationAnyone can create or delete a product through the public API
PaginationThe whole table is returned on every GET
Search, filtersEverything must be fetched and filtered client-side

These items are tracked in the Limits; they will be addressed in the web part (702).

The full code is explained in The products API.