Expenses

The Expense Object

You can save expense categories for reuse in statements.

EXAMPLE OBJECT

{
  "expense_category: {
    "id": 12,
    "name": "Travelling",
    "created_at": "2014-07-21T11:04:58Z"
  }
}

Attributes

Attribute Description
id integer Expense ID
name string Expense name

Create a New Expense

DEFINITION
POST https://[subdomain].hiveage.com/api/categories/expenses

EXAMPLE JSON REQUEST
$ curl https://[subdomain].hiveage.com/api/categories/expenses\
  -H "Accept: application/json" \
  -u 6ZQHxidcLHnkcsnDbfM5: \
  -d expense_category[name]="Travelling" \


EXAMPLE RESPONSE
{
  "expense_category": {
    "id": 13,
    "name": "Travelling",
    "formatted_price": "150.00",
    "created_at": "2014-07-21T11:04:58Z"
  }
}

Attributes

Parameter Description
name required

Return

Returns the expense object.

Retrieve an Expense

Retrieve an expense object with a specified ID.

DEFINITION
GET https://[subdomain].hiveage.com/api/categories/expenses/[id]

EXAMPLE JSON REQUEST
$ curl https://[subdomain].hiveage.com/api/categories/expenses/[id]\
  -H "Accept: application/json" \
  -u 6ZQHxidcLHnkcsnDbfM5: \

EXAMPLE RESPONSE
{
  "expense_category": {
    "id": 13,
    "name": "Travelling",
    "created_at": "2014-07-21T11:04:58Z"
  }
}

Arguments

Parameter Description
id required The id of expense category object.

Returns

Returns a expense JSON object if a valid expense category ID was provided. Returns an error otherwise.

Update an Expense

Update an expense category.

DEFINITION
PUT https://[subdomain].hiveage.com/api/categories/expenses/[id]

EXAMPLE JSON REQUEST
$ curl https://[subdomain].hiveage.com/api/categories/expenses/[id]\
  -H "Accept: application/json" \
  -u 6ZQHxidcLHnkcsnDbfM5: \
  -d expense_category[name]="Foods" \

EXAMPLE RESPONSE
{
  "expense_category": {
    "id": 13,
    "name": "Foods",
    "created_at": "2014-07-21T11:04:58Z"
  }
}

Arguments

Arguments Description
name required Expense name, NOTE: When you search saved expense cantegories to add one as a line item, you can search by item name or description.
description optional Expense descripton
unit optional Expense unit
price required

Returns

Returns a updated expense JSON object if a valid item ID was provided. Returns an error otherwise.

Delete an Expense

Deleting an expense object permanently.

DEFINITION
DELETE https://[subdomain].hiveage.com/api/categories/expenses/[id]

EXAMPLE REQUEST
$ curl https://[subdomain].hiveage.com/api/categories/expenses/[id]\
  -H "Accept: application/json" \
  -u 6ZQHxidcLHnkcsnDbfM5: \

SAMPLE JSON RESPONSE
{
  "expense_category": {
    "deleted": true,
    "id": 13
  }
}

Arguments

Parameter Description
id required The ID of the expense to be deleted.

Returns an object with a deleted parameter on success.

List All Expenses

Return list of expenses. The items are returned sorted alphabetically.

DEFINITION
GET https://[subdomain].hiveage.com/api/categories/expenses

EXAMPLE REQUEST
$ curl https://[subdomain].hiveage.com/api/categories/expenses\
  -H "Accept: application/json" \
  -u 6ZQHxidcLHnkcsnDbfM5: \

SAMPLE JSON RESPONSE
{
  "expense_categories": [{
    "id": 13,
    "name": "My Item",
    "created_at": "2014-07-21T11:04:58Z"
  }
  {...},
  {...}]
}

The results will be paginated. You can use the following optional parameters to traverse the results.

Arguments

Parameter Description
per_page optional Number of results per page (default: 20). Available per page: 20, 60 and 100.
page optional Page in result-set
order optional The list is ordered by name, and can be ordered by desc or asc. The defaul value is asc.