Field Name | Unique? | Validation |
---|---|---|
name | ✔ | ^[a-zA-Z0-9_. ]+$ |
slug | ^[a-z0-9_-]+$ | |
address | ||
lat | ||
long | ||
geohash | ||
availability_afterhours | ||
availability_weekends | ||
business_hours_start | ||
business_hours_end |
Resource | 1-to-1 | 1-to-many | many-to-1 | many-to-many |
---|---|---|---|---|
company | ✔ | |||
vehicle | ✔ |
Returns the branch hashes which also contain the distance from the user to the branch in kilometres.
Operation: GET /branches
Intent: return a list of branches for the current company.
Status: 200 OK
Response body:
[
{
"id": 1,
"location": "/branch/1",
"name": "Wilford London",
"slug": "wfldn",
"address": "1 The Strand",
"lat": "51.5114",
"long": "-0.1189",
"geohash": "gcpvj337t",
"distance": "4.53"
}
]
Operation: GET /branch/1
Intent: return a hash for the branch with an id of ID.
Status: 200 OK
Response body:
{
"id": 1,
"location": "/branch/1",
"name": "Wilford London",
"slug": "wfldn",
"address": "1 The Strand",
"lat": "51.5114",
"long": "-0.1189",
"geohash": "gcpvj337t",
"company": { COMPANY HASH },
"totals": { RESOURCE VOLUMES }
}
Operation: POST /branch
Intent: create a new branch linked to the current company
Request body:
{
"name": "Wilford NYC",
"slug": "wfnyc",
"address": "2 Warren Street",
"lat": "40.7127",
"long": "-74.0059",
"geohash": "dr5regw89"
}
Status: 201 Created
Response body:
{
"location": "/branch/2"
}
Operation: PUT /branch/2
Intent: update existing branch
Request body:
{
"name": "Wilford New York"
}
Status: 200 OK
Response body:
{
"id": 2,
"location": "/branch/2",
"name": "Wilford New York",
"slug": "wfnyc",
"address": "2 Warren Street",
"lat": "40.7127",
"long": "-74.0059",
"geohash": "dr5regw89"
}
Operation: DELETE /branch/2
Intent: delete an existing branch
Status: 200 OK
Returns vehicles which are available to be booked based on the dates supplied.
Note
Business hours and vehicle availability are taken into consideration.
Operation: GET /branch/1/vehicles/{ DATETIME PATH }
Intent: get bookable vehicles for a date range
Returns a list of resource hashes for each manager associated to the branch.
Operation: GET /branch/1/managers
Intent: fetch manager information for branch 1
Sets the list of managers for a branch to the supplied list of user IDs.
Warning
There is no restriction in the API for permissions required to perform this operation as none were defined at the time of implementation.
Operation: POST /branch/1/managers
Intent: set the list of managers for branch 1
Request body: [1, 2, 3]
Returns a list of bookings and their state for the specified date range.