Expenses

Manage expenses

CREATE

POST https://api.pesatime.com/v1/expenses

Record a new expense

Request Body

NameTypeDescription

description

string

Add any other information here

category

string

The category ID

date

string

The date of the expense in format YYYY-MM-DD HH:MM

amount

number

The expense amount

{
  "status": 1,
  "message": "Saved",
  "data": {
    "_id": "5dce4b8a4d44af36f693cd2b"
  }
}

UPDATE

PUT https://api.pesatime.com/v1/expenses/:expenseId

Update an expense

Path Parameters

NameTypeDescription

expenseId

string

The ID of the expense to update

Request Body

NameTypeDescription

description

string

New description for the exp

category

string

The new category ID

date

string

Date in format YYYY-MM-DD

amount

number

The new amount

{
  "status": 1,
  "message": "Expense updated successfully"
}

RETRIEVE - All

GET https://api.pesatime.com/v1/expenses

Retrieves all expenses

Path Parameters

NameTypeDescription

expenseID

string

The ID of the expense to retrieve details for

Query Parameters

NameTypeDescription

description

string

Search part of the description

category

string

The ID of the category

date_to

string

Date expense incurred (YYYY-MM-DD) e.g. 2019-10-14

date_from

string

Date expense incurred (YYYY-MM-DD) e.g. 2019-10-13

{
  "status": 1,
  "data": [
    {
      "amount": 10001,
      "active": true,
      "_id": "5dce51d0bf6c524c59a75c96",
      "organization": "5db5a64a6cb3e2060a7b864c",
      "user": "5cded7f553ea376e8bba6bfd",
      "category": {
        "_id": "5cdfb75bb8f2b84e5fb55ce6",
        "name": "Office supplies"
      },
      "description": "20 copies ",
      "date": "2019-01-23T00:00:00.000Z",
      "attachments": [],
      "dateCreated": "2019-11-15T07:20:48.818Z",
      "__v": 0
    },
    
    .......
  
  ]
}

RETRIEVE - single item

GET https://api.pesatime.com/v1/expenses/:expenseId

Get details of one item

Path Parameters

NameTypeDescription

expenseId

string

Id of the expense to get details for

{
  "status": 1,
  "data": {
    "amount": 10001,
    "active": true,
    "_id": "5dce51d0bf6c524c59a75c96",
    "organization": "5db5a64a6cb3e2060a7b864c",
    "user": "5cded7f553ea376e8bba6bfd",
    "category": {
      "_id": "5cdfb75bb8f2b84e5fb55ce6",
      "name": "Office supplies"
    },
    "description": "20 copies ",
    "date": "2019-01-23T00:00:00.000Z",
    "attachments": [],
    "dateCreated": "2019-11-15T07:20:48.818Z",
    "__v": 0
  }
}

DELETE

DELETE https://api.pesatime.com/v1/expenses/:expenseId

Delete a category

Path Parameters

NameTypeDescription

expenseId

string

The ID of the expense to delete

{
  "status": 1,
  "message": "Expense deleted successfully"
}

Last updated