Skip to main content

REST API: Get a List of Cost Centers

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

Gustavo Vera avatar
Written by Gustavo Vera
Updated today

1. Login

Before calling any API, you must first authenticate.
The login endpoint returns a token that must be included in all subsequent requests.

Example (cURL)

[email protected] password=XXXXXXX  url=https://www.tspoonlab.com/recipes/api authenticate="username=$username&password=$password"  echo -n 'rememberme:' > rememberme.txt curl -v --data "$authenticate" "$url/login" >> rememberme.txt

Then include the token in the headers of all future requests:

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

2. Get the List of Cost Centers / Restaurants

To retrieve the list of cost centers (restaurants) the current user has access to, use:

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

The response returns an array of UserOrderCenter objects with HTTP code 200.


Response Example

public class UserOrderCenter {   private String id;                   // Relationship ID (user ↔ cost center)   private String idOrderCenter;        // Cost center ID   private String descr;                // Description / name of the cost center   private Boolean active;              // Whether it's the default active center    private String culture;              // Language / culture   private String country;              // Country    private String name;                 // Legal name   private String cp;                   // Postal code   private String city;                 // City   private String address;              // Address   private String nif;                  // Tax ID    private String mail;                 // Email address   private String telfs;                // Phone number   private String mailText;             // Default email text   private String mailSignature;        // Email signature    private String codi;                 // Internal code   private String currency;             // Currency used    private short decimalsCurrencyShort; // Decimal precision (< 1)   private short decimalsCurrencyLong;  // Decimal precision (> 1) }

Notes

  • This endpoint lists all restaurants or business units the user has access to.

  • Each UserOrderCenter entry represents the link between the authenticated user and a cost center.

  • You must include the login token (rememberme) in your headers.

Did this answer your question?