Apollo API Documentation

Expenses API calls


Get expenses

GET /projects/#{project_id}/expenses/#{page}

Returns the 25 most recent expenses in the given project. The {page} parameter is optional. If there are older expenses not included in the response, the root response element will also have a “continued-at” attribute specifying the path where the next oldest 25 expenses can be retrieved.

Response

{
	"continued-at":"/projects/1/expenses/2",
	"expenses":[
		{
			"id":"61755784",
			"date":"2018-03-30",
			...
		},
		{
			"id":"35371388",
			"date":"2018-04-29",
			...
		},
		...
	]
}

Get expense

GET /expenses/#{id}

Returns a single expense record identified by its integer ID.

Response

{
	"expense":{
		"id":"61755784",
		"date":"2018-04-30",
		...
	}
}

Create expense

POST /projects/#{project_id}/expenses

Creates a new expense.

Request

{
	"expense":{
		"category-id":"51524282",
		"date":"2018-04-14",
		"amount":"250",
		"notes": "Restaurant",
		"billable":"not billable"
	}
}

Response

Returns HTTP status code 201 (“Created”) on success. The response contain the new expense ID. On failure, a non-200 status code will be returned, possibly with error information in JSON format as the response's content.

{
	"expense-id":"140104985"
}

Update expense

PUT /expense/#{id}

Updates an existing expense.

Request

{
	"expense":{
		"date":"2018-04-25"
	}
}

Response

Returns HTTP status code 200 on success, or any other code (and possibly error information in JSON format) on error.


Destroy expense

DELETE /expense/#{id}

Destroys the given expense.

Response

Returns HTTP status code 200 on success, or any other code (and possibly error information in JSON format) on error.