- Développeurs
- Référence API
- Locations, Accounts and Users
Locations, Accounts and Users
1. Locations
1.1 Retrieve Location
Get location details.
Endpoint: | GET /locations/:id |
Short endpoint: | GET /location (location only) |
Access level: | location, account |
Example request
GET /locations/3r4s3-1
{ "id": "3r4s3-1", "name": "Paris", "account": { "id": "3r4s3", "name": "Bella Pizza", "currency": "EUR" }, "address": "13 rue du Chant des Oiseaux", "postal_code": "75003", "city": "Paris", "country": "FR", "timezone": { "name": "Europe/Paris" }, "cutoff_time": "06:00", "opening_hours": { "monday": [ { "from": "12:00", "to": "14:00" }, { "from": "18:00", "to": "01:00" } ], // ... other days of the week }, "custom_fields": { "delivery": { "door_time": "35" } }}
Parameters:
Name | Type | Description |
---|---|---|
id | string | Unique id of the location, generated by HubRise. |
name | string | The name of the location. Can only be changed from the HubRise back office. |
account | Account | The account to which the location belongs. |
address | string | The address of the location. |
postal_code | string | The postal code of the location. |
city | string | The city of the location. |
country | string | The country of the location. |
timezone | Timezone | The timezone of the location. |
cutoff_time | string | The time of the day when opening hours are cut off. See Opening Hours. |
opening_hours | OpeningHours | The opening hours of the location. null indicates they have not been set. |
custom_fields | CustomFields | Custom fields are useful to pass information that is not part of the standard HubRise API. |
Note: the timezone.offset
field is deprecated and should not be used, as it does not take daylight saving time into account.
Opening Hours
The opening_hours
field represents the opening hours for a location on each day of the week: monday
, tuesday
, etc. You can provide multiple time slots for each day, specifying the from
and to
times in the HH:mm
format. For example:
{ "opening_hours": { "monday": [ { "from": "12:00", "to": "14:00" }, { "from": "18:00", "to": "01:00" // Next day because 01:00 is before the cutoff time (= 06:00) } ], // ... other days of the week }}
You can skip some days, in which case the location will be considered closed on those days, but at least one time slot must be provided for the week.
For each time slot, to
must follow from
. Additionally, there must be no overlap between time slots of the same day.
The cutoff_time
is a location level field, with a default value of 06:00
. It allows time slots to span across midnight. In the example above, the second time slot ends at 01:00
, which is considered on the same day as 18:00
, because 01:00
is before the cutoff_time
. If the cutoff_time
was 00:00
, 01:00
would be considered on the next day and the API would return an error.
1.2 Update Location
Updates a location.
Endpoint: | PATCH /locations/:id |
Short endpoint: | PATCH /location (location only) |
Access level: | location, account |
The following fields can be updated: cutoff_time
, opening_hours
, and custom_fields
.
Example request
PATCH /locations/3r4s3-1
{ "cutoff_time": "05:00", "opening_hours": { "monday": [ { "from": "09:00", "to": "12:30" }, { "from": "14:00", "to": "23:30" } ], "tuesday": [ { "from": "09:00", "to": "12:30" }, { "from": "14:00", "to": "23:30" } ], "wednesday": [ { "from": "09:00", "to": "12:30" }, { "from": "14:00", "to": "01:30" } ], "thursday": [], "friday": [ { "from": "17:00", "to": "02:00" } ], "saturday": [ { "from": "18:00", "to": "02:00" } ], "sunday": [ { "from": "18:00", "to": "23:00" } ] }, "custom_fields": { "delivery": { "door_time": "35" } }}
1.3 List Locations
Returns the locations of the account.
Endpoint: | GET /locations/ |
Access level: | account |
Example request:
GET /locations
[ { "id": "3r4s3-1", "name": "Paris", "account": { "id": "3r4s3", "name": "Bella Pizza", "currency": "EUR" } ... } ...]
2. Accounts
2.1 Retrieve Account
Get account details.
Endpoint: | GET /accounts/:id |
Short endpoint: | GET /account |
Access level: | account |
Example request:
GET /accounts/3r4s3
{ "id": "3r4s3", "name": "Mister Pizza", "currency": "EUR"}
3. Users
3.1 Retrieve User
Get user information.
Endpoint: | GET /user |
Access level: | profile, profile_with_email |
Example request:
GET /user
{ "id": "v6ap7", "first_name": "Tom", "last_name": "Jones", "email": "tom.jones@dummy-mail.org", "timezone": { "name": "Europe/Paris" }, "locales": ["en-GB", "fr-FR"]}
The email
field is included only if the access level is profile_with_email
.