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],
    "deactivated": 0,
    "send_to_accounting": 1,
    "external_id": "ABC",
    required_dimension: true
  },
  {
    "id": 10,
    "name": "And Another Cost Center",
    "dimension_name": "BLAA",
    "assignee_ids": [9,13],
    "deactivated": 0,
    "send_to_accounting": 1,
    "external_id": "ABC",
    required_dimension: false
  }
] 

Params

Param name Description
page
optional

Page number

Validations:

  • Must be a Integer

per_page
optional

Number of records per page. Can be set to 1000 for getting more cost centers in one page. Default: 500

Validations:

  • Must be a Integer

skip_pagination
optional

Pass true to skip pagination and receive all the cost centers in one request, no pagination.

Validations:

  • Must be one of: true, false, 1, 0.


POST /api/cost_centers
Create cost center

Create cost center

Examples

{
  cost_center: {
    name: 'Blaname',
    dimension_name: 'Bla Dimension',
    assignee_ids: [1, 2, 55],
    deactivated: 0,
    send_to_accounting: 1,
    external_id: "ABC",
    required_dimension: true
    procountor: {
      dimension_id: 1,
      item_id: 1
    },
    netsuite: { internalid: '1' }
  }
}

Example curl request:
curl -H "Authorization: Bearer token" -H "Content-Type: application/json" -X POST -d '{"cost_center": {"name": "foo", "dimension_name": "bar"}}' https://app.bezala.com/api/cost_centers
    

Params

Param name Description
cost_center
required

Validations:

  • Must be a Hash

cost_center[name]
required

Cost center name.

Validations:

  • Must be a 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. Please note, name change entails required_dimension value change of Cost Centers with the same name with the value of the required_dimension of the current Cost Center

Validations:

  • Must be a 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 a 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 a Integer

cost_center[external_id]
optional , nil allowed

Cost Center’s External ID, used in external services.

Validations:

  • Must be a String

cost_center[required_dimension]
optional , nil allowed

Make Dimension of current Cost Center required in Expense forms (Receipt, Per Diem, Daily Allowance, Reward). By setting this value in one Cost Center, all Cost Centers with the same Dimension name will be updated with the same value in required_dimension field. Default: false.

Validations:

  • Must be one of: true, false, 1, 0.

cost_center[netsuite]
optional , nil allowed

NetSuite settings in hash

Validations:

  • Must be a Hash

cost_center[procountor]
optional , nil allowed

Procountor settings in hash

Validations:

  • Must be a Hash

cost_center[approvers_attributes]
optional , nil allowed

Add/Remove cost center approvers

Validations:

  • Must be an Array of nested elements

cost_center[approvers_attributes][id]
optional , nil allowed

Cost center approver id, required if user approver already exists. If it’s not supplied, new cost center approver will be added

Validations:

  • Must be a Integer

cost_center[approvers_attributes][approver_id]
required

Approver id

Validations:

  • Must be a Integer

cost_center[approvers_attributes][operator]
required

Operator specifying approver process logic

Validations:

  • Must be one of: then, or.

cost_center[approvers_attributes][_destroy]
optional , nil allowed

Pass “true” here to delete an existing approver

Validations:

  • Must be one of: true, false, 1, 0.


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 a 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. Please note, name change entails required_dimension value change of Cost Centers with the same name with the value of the required_dimension of the current Cost Center

Validations:

  • Must be a 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 a 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 a Integer

cost_center[external_id]
optional , nil allowed

Cost Center’s External ID, used in external services.

Validations:

  • Must be a String

cost_center[required_dimension]
optional , nil allowed

Make Dimension of current Cost Center required in Expense forms (Receipt, Per Diem, Daily Allowance, Reward). By setting this value in one Cost Center, all Cost Centers with the same Dimension name will be updated with the same value in required_dimension field. Default: false.

Validations:

  • Must be one of: true, false, 1, 0.

cost_center[netsuite]
optional , nil allowed

NetSuite settings in hash

Validations:

  • Must be a Hash

cost_center[procountor]
optional , nil allowed

Procountor settings in hash

Validations:

  • Must be a Hash

cost_center[approvers_attributes]
optional , nil allowed

Add/Remove cost center approvers

Validations:

  • Must be an Array of nested elements

cost_center[approvers_attributes][id]
optional , nil allowed

Cost center approver id, required if user approver already exists. If it’s not supplied, new cost center approver will be added

Validations:

  • Must be a Integer

cost_center[approvers_attributes][approver_id]
optional

Approver id

Validations:

  • Must be a Integer

cost_center[approvers_attributes][operator]
optional

Operator specifying approver process logic

Validations:

  • Must be one of: then, or.

cost_center[approvers_attributes][_destroy]
optional , nil allowed

Pass “true” here to delete an existing approver

Validations:

  • Must be one of: true, false, 1, 0.


PUT /api/cost_centers/:id/toggle_deactivated
Activate or Deactivate cost center

Toggle deactivated field of cost center