Cost Centre API

Fields

Field Name Unique? Validation
name   ^[a-zA-Z0-9_. ]+$
code ^[a-zA-Z0-9_-]+$

Relationships

Resource 1-to-1 1-to-many many-to-1 many-to-many
user      
company      
vehicle      

Operations

GET /cost-centres

Returns a list of cost-centres for the current company. A list of managers is also included.

GET /cost-centre/ID

Returns a single cost-centre along with some reporting data.

POST /cost-centre

Creates a new cost-centre for the current company.

PUT /cost-centre/ID

Updates an existing cost-centre.

DELETE /cost-centre/ID

Deletes a cost-centre.

GET /cost-centre/ID/bookings/DATETIMEPATH

Returns bookings for the cost-centre.

GET /cost-centre/ID/managers

Gets the list of managers for the cost-centre.

POST /cost-centre/ID/managers

Replaces the list of managers for the cost-centre with a list passed in via the request body.

Operation: POST /cost-centre/90/managers
Intent: replace the current list of managers for cost-centre 90
Request body:
{
    "managers": [1, 4, 13, 14]
}
Status: 201 Created