Company API

Fields

Field Name Unique? Validation
name   ^[a-zA-Z0-9_. ]+$
slug ^[a-z0-9_-]+$
contact_number   ^.+$
contact_email   ^.+$
address   ^.+$
lat    
long    
description    
url    
vehicle_cost    
vehicle_cost_type    
currency    
order_booking_results_by    
booking_tolerance    

Relationships

Resource 1-to-1 1-to-many many-to-1 many-to-many
user      
branch      
cost-centre      

Operations

GET /companies

Retrieves a list of active companies. If the user has either admin or keaz permissions, all active companies are returned. Otherwise, only companies of which the user is a member are returned.

GET /company/ID

Returns a single company hash.

Operation: GET /company/1
Intent: get information for company 1
Status: 200 OK
Response body: { COMPANY HASH }

POST /company

Create a new company resource. The user which creates the company will become associated to it.

PUT /company/ID

Update a company resource.

DELETE /company/ID

Deletes a company resource.

GET /company/ID/user/USERID

Checks the membership of a user within a company. The response status code indicates the result of this check. If the user is a member of the company, a 200 OK status is returned, otherwise a 404 Not Found will be raised.

Operation: GET /company/1/user/2
Intent: is user 2 a member of company 1
Status: 404 Not Found

POST /company/ID/user/USERID

Add a user to a company.

DELETE /company/ID/user/USERID

Delete a user from a company.

GET /company/ID/branch/BRANCHID

Check the membership of a branch within a company.

POST /company/ID/branch/BRANCHID

Add a branch to a company.

DELETE /company/ID/branch/BRANCHID

Remove a branch from a company.

GET /company/ID/assets/TAG

Gets a single asset for the company - the asset with a tag of TAG.

GET /company/ID/assets

Returns all assets for a company.

POST /company/ID/assets/TAG

Adds an asset to a company.

GET /company/ID/bookings/DATETIMEPATH

Return a list of the company’s bookings.

GET /company/ID/templates/TAG

Return one email template from the company.

GET /company/ID/templates

Return all email templates that belong to the company.

POST /company/ID/templates/TAG

Add new email template for the company.