GET /api/cost_centers
Get cost centers list

Returns the list of cost centers

Supported Formats

json

Examples

[
  {
    "id":3,
    "name":"Alternative Cost Center",
    "dimension_name":"Alternative",
    "assignee_ids":[9,13,15]
  },
  {
    "id":10,
    "name":"And Another Cost Center",
    "dimension_name":"BLAA",
    "assignee_ids":[9,13]
  }
] 

POST /api/cost_centers
Create cost center

Create cost center

Examples

{
  cost_center: {
    name: 'Blaname',
    dimension_name: 'Bla Dimension',
    assignee_ids: [1, 2, 55]
  }
}
    

Params

Param name Description
cost_center
required

Validations:

  • Must be a Hash

cost_center[name]
required

Cost center name.

Validations:

  • Must be String

cost_center[dimension_name]
required

Cost center dimension name. Cost centers with similar dimension name are grouped into one drop down in transaction form.

Validations:

  • Must be String

cost_center[assignee_ids]
optional , nil allowed

Ids of users assigned to this cost center. Passing nil here will remove all assignees.

Validations:

  • Must be an array of Integer

cost_center[deactivated]
optional , nil allowed

Whether cost center should be hidden from transaction form. Default: false. Possible values: either 1 or 0.

Validations:

  • Must be Integer

cost_center[send_to_accounting]
optional , nil allowed

Whether cost center should be sent to accounting. It doesn't affect the UI. Default: true. Possible values: 1, 0

Validations:

  • Must be Integer


PUT /api/cost_centers/:id
Update cost center

Update cost centers. It is possible to edit any of its fields

Params

Param name Description
cost_center
required

Validations:

  • Must be a Hash

cost_center[name]
optional

Cost center name.

Validations:

  • Must be String

cost_center[dimension_name]
optional

Cost center dimension name. Cost centers with similar dimension name are grouped into one drop down in transaction form.

Validations:

  • Must be String

cost_center[assignee_ids]
optional , nil allowed

Ids of users assigned to this cost center. Passing nil here will remove all assignees.

Validations:

  • Must be an array of Integer

cost_center[deactivated]
optional , nil allowed

Whether cost center should be hidden from transaction form. Default: false. Possible values: either 1 or 0.

Validations:

  • Must be Integer

cost_center[send_to_accounting]
optional , nil allowed

Whether cost center should be sent to accounting. It doesn't affect the UI. Default: true. Possible values: 1, 0

Validations:

  • Must be Integer