Skip to main content

REST API: Cost centers 🏡​

How to retrieve all cost centers (restaurants) available to the current user

How to get a list of cost centers / restaurants?

To make calls to our APIs, the first thing you need is to authenticate through a login call. That call returns a token that you must then attach to every subsequent call.

This shell script shows how to authenticate using curl:

[email protected]
password=XXXXXXX

url=https://app.tspoonlab.com/recipes/api
authenticate='username='$username'&password='$password

echo -n 'rememberme:' > rememberme.txt
curl -v --data $authenticate $url/login >> rememberme.txt

On later calls, add the token received from the login call to your headers:

curl -X PUT -v -H "$(cat rememberme.txt)"  $url/integration/llamada

Get the list of cost centers / restaurants

To get the list of cost centers/restaurants your user has access to, make this call:

GET: https://app.tspoonlab.com/recipes/api/orderCenters

It returns an array of the UserOrderCenter class and a 200 code.

public class UserOrderCenter {
private String id; // Identificador de la relaciĂłn usuario/centro de coste
private String idOrderCenter; // identificador del centro de coste
private String descr; // DescripciĂłn del centro de coste
private Boolean active; // Si es el order center activo por defecto

private String culture; // culture del order center
private String country; // pais del order center

private String name; // Datos identificativos
private String cp;
private String city;
private String address;
private String nif;

private String mail;
private String telfs;
private String mailText;
private String mailSignature;

private String codi; // CĂłdigo del orderCenter
private String currency; // Moneda

private short decimalsCurrencyShort; // NĂșmero de decimales para importes menores que 1
private short decimalsCurrencyLong; // NĂșmero de decimales para importes mayores que 0
}

Did you find this article helpful?

If you need further assistance, contact support by clicking the built-in Support Chat in the bottom-right corner of your screen.


Did this answer your question?