Skip to main content

REST API: Customers

List customers and retrieve customer information

List clients and client types, retrieve a client and its products for sale.

GET /listCustomersPaged
GET /listCustomerTypesPaged
GET /customer/{idCustomer}
GET /customer/{idCustomer}/components/paged

Each cost center has its own clients, which sales are made to.


Before you start

Base URL: https://app.tspoonlab.com/recipes/api

Headers

  • rememberme · required — Session token returned by the login.

  • order · optional — Cost center id (Cost centers). List clients returns the clients of this cost center. Defaults to the user's active cost center.

Login — Returns the token as plain text.

curl https://app.tspoonlab.com/recipes/api/login \
-d [email protected] \
-d password=XXXXXXX

Permissions — Permission to view clients. Listing client types requires permission to view client types.

Responses may include fields other than the documented ones. Use only the documented fields.


List clients

GET /listCustomersPaged

Query parameters

  • start integer · required — Position of the first row, starting at 0.

  • rows integer · required — Number of rows to return.

  • filter string · optional — Text to filter by name, code or client type.

  • hidden boolean · optional — true returns only hidden clients. Defaults to false: only clients that are not hidden.

Example

curl "https://app.tspoonlab.com/recipes/api/listCustomersPaged?start=0&rows=50" \
-H "rememberme: $TOKEN"

Response

[
{
"id": "3515834441676562996102020901",
"descr": "Downtown Restaurant",
"codi": "C001",
"defecte": true,
"idType": "3515834441676562996102020951",
"descrType": "Dining room"
}
]
  • id string — Client id.

  • descr string — Name.

  • codi string — Code.

  • defecte boolean — true if it is the default client.

  • idType, descrType string — Client type (see List client types).


List client types

Types are used to classify clients.

GET /listCustomerTypesPaged

Query parameters

  • start integer · required — Position of the first row, starting at 0.

  • rows integer · required — Number of rows to return.

  • filter string · optional — Text to filter types by name or code.

Example

curl "https://app.tspoonlab.com/recipes/api/listCustomerTypesPaged?start=0&rows=50" \
-H "rememberme: $TOKEN"

Response

[
{ "id": "3515834441676562996102020951", "descr": "Dining room", "codi": "DIN" }
]
  • id string — Type id.

  • descr string — Name.

  • codi string — Code.


Retrieve a client

If the client does not exist, the response is empty.

GET /customer/{idCustomer}

Path parameters

  • idCustomer string · required — Client id.

Example

curl https://app.tspoonlab.com/recipes/api/customer/3515834441676562996102020901 \
-H "rememberme: $TOKEN"

Response

{
"id": "3515834441676562996102020901",
"descr": "Downtown Restaurant",
"codi": "C001",
"defecte": true,
"nif": "B12345678",
"comment": null,
"web": "https://www.downtownrestaurant.com",
"mailcc": "[email protected]",
"address": "10 High Street",
"city": "Barcelona",
"cp": "08001",
"idCustomerType": "3515834441676562996102020951",
"listContact": [
{ "id": "3515834441676562996102021001", "descr": "Laura Smith", "phone": "+34 600 000 000" }
],
"listMail": [
{ "id": "3515834441676562996102021002", "descr": "[email protected]" }
],
"listGroups": [
{
"id": "3515834441676562996102021003",
"idCustomerGroup": "3515834441676562996102021004",
"customerGroup": "Drinks",
"codiCustomerGroup": "DRK",
"comment": null
}
]
}
  • id string — Client id.

  • descr string — Name.

  • codi string — Code.

  • defecte boolean — true if it is the default client.

  • nif string — Tax ID.

  • comment string — Comment.

  • web string — Website.

  • mailcc string — Address that receives a copy of the orders emailed to the client.

  • address, city, cp string — Address, city and postcode.

  • idCustomerType string — Client type. null if it has none.

  • listContact array — Contacts: id, descr (name) and phone.

  • listMail array — Contact emails: id and descr (email address).

  • listGroups array — The client's groups of products for sale.

Each group:

  • id string — Id of the group in this client.

  • idCustomerGroup, customerGroup, codiCustomerGroup string — Group id, name and code.

  • comment string — Comment.


List a client's products for sale

Returns the products and menus the client has for sale. By default, those without a group and those in each group; to get a single group, send showAll=false. Discontinued items are not included.

GET /customer/{idCustomer}/components/paged

Path parameters

  • idCustomer string · required — Client id.

Query parameters

  • start integer · optional — Position of the first row, starting at 0. Defaults to 0.

  • rows integer · optional — Number of rows to return. If omitted, all rows are returned. With showAll=true, start and rows apply separately to the items without a group and to each group.

  • filter string · optional — Text to filter by product or menu name, sale description or PLU.

  • showAll boolean · optional — true returns the items without a group and those in every group, and ignores idGroup. false returns only the items in group idGroup, or those without a group if idGroup is not sent. Defaults to true.

  • idGroup string · optional — Group to get the items of (id in listGroups in Retrieve a client). Only filters with showAll=false. If the group does not exist, the call returns an error.

Example — Items in one group:

curl "https://app.tspoonlab.com/recipes/api/customer/3515834441676562996102020901/components/paged?showAll=false&idGroup=3515834441676562996102021003" \
-H "rememberme: $TOKEN"

Response

[
{
"id": "3515834441676562996102021101",
"idComponent": "3515834441676562996102021201",
"component": "Classic burger",
"idMenu": null,
"menu": null,
"plu": "HA001",
"quantity": 1,
"idUnit": "3515834441676562996102021301",
"unit": "portion",
"cost": 19.9,
"iva": 10,
"currency": "€",
"costComponent": 4.85,
"percentCost": 0.2681
}
]
  • id string — Id of the item for sale.

  • idComponent, component string — Product sold, if it is a product.

  • idMenu, menu string — Menu sold, if it is a menu.

  • plu string — Item code in the POS.

  • quantity number — Quantity for sale.

  • idUnit string — Sale unit id.

  • unit string — Sale unit description.

  • cost number — Sale price including VAT.

  • iva number — VAT rate, in %.

  • currency string — Currency symbol of the cost center, for example €.

  • costComponent number — Product cost for the quantity for sale.

  • percentCost number — Food cost: cost divided by the sale price excluding VAT, as a fraction (0.2681 = 26.81%).

Need help? Message us from the support chat in the bottom-right corner.

Did this answer your question?