Expense Categories

Show all categories

GET https://YOURACCOUNT.harvestapp.com/expense_categories

To show a single expense category, update your request as follows:

GET https://YOURACCOUNT.harvestapp.com/expense_categories/{EXPENSECATEGORYID}

HTTP Response: 200 OK

Examples

Example request in Postman

<?xml version="1.0" encoding="UTF-8"?>
<expense-categories type="array">
    <expense-category>
        <id type="integer">1338056</id>
        <name>Entertainment</name>
        <unit-name nil="true"/>
        <unit-price type="decimal" nil="true"/>
        <created-at type="dateTime">2015-04-17T20:28:12Z</created-at>
        <updated-at type="dateTime">2015-04-17T20:28:12Z</updated-at>
        <deactivated type="boolean">false</deactivated>
    </expense-category>
</expense-categories>
[
    {
        "expense_category": {
            "id": 1338056,
            "name": "Entertainment",
            "unit_name": null,
            "unit_price": null,
            "created_at": "2015-04-17T20:28:12Z",
            "updated_at": "2015-04-17T20:28:12Z",
            "deactivated": false
        }
      }
]

Create new expense category

POST https://YOURACCOUNT.harvestapp.com/expense_categories

After a successful request, we’ll return LOCATION: /expense_categories/{NEWEXPENSECATEGORYID}, as well as HTTP Response: 201 Created

Note: unit-name and unit-price are only required for expense categories based on unit values.

Examples

Example request in Postman

<expense-category>
  <name>New Category</name>
  <unit-name>Bananas</unit-name>
  <unit-price type="decimal">12</unit-price>
</expense-category>
{
    "expense_category": {
        "name": "New Category",
        "unit_name": "Bananas",
        "unit_price": 12
    }
}

Update expense category

PUT https://YOURACCOUNT.harvestapp.com/expense_categories/{EXPENSECATEGORYID}

After a successful request, we’ll return LOCATION: /expense_categories/{NEWEXPENSECATEGORYID}, as well as HTTP Response: 200 OK.

Examples

Example request in Postman

<expense-category>
  <name>Renamed New Category</name>
  <unit-name>Apples</unit-name>
  <unit-price type="decimal">10</unit-price>
</expense-category>
{
    "expense_category": {
        "name": "Renamed New Category",
        "unit_name": "Apples",
        "unit_price": 10
    }
}

Delete expense category

DELETE https://YOURACCOUNT.harvestapp.com/expense_categories/{EXPENSECATEGORYID}

If the category has no expenses tracked to it, HTTP Response: 200 OK will be returned. Otherwise, HTTP Response: 400 Bad Request will be returned if the category is unable to be deleted.

Still have questions? We’re happy to help!

Contact Us