Rest API: How to get a list of cost centers / restaurants?
System login
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; // User/cost-center relationship id
private String idOrderCenter; // cost center id
private String descr; // Cost center description
private Boolean active; // Whether it is the default active order center
private String culture; // order center culture
private String country; // order center country
private String name; // Identifying data
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; // orderCenter code
private String currency; // Currency
private short decimalsCurrencyShort; // Number of decimals for amounts under 1
private short decimalsCurrencyLong; // Number of decimals for amounts over 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.
