Use this REST API to manage and administer expenses. With this resource, you can retrieve expenses lists, create, update, and delete expenses in your WebWork account.
Below we provide an example of the data which is required for each scenario.
You can get all the expenses in your workspace with the following URL request
Copy code GET https://www.webwork-tracker.com/rest-api/expenses
Retrieves a list of expenses in your workspace. By default, results are paginated (50 rows per page). You can optionally filter expenses by including any combination of the following query parameters.
Copy code GET https://www.webwork-tracker.com/rest-api/expenses?id={id}&date_from={date_from}&date_to={date_to}&page={page}
The response returns a json format. Below you can see an example of response structure.
Copy code max_rows: "{max_rows}" current_page: "{current_page}" total_pages: "{total_pages}" data: [ { "id": "{id}" "member": "{member}" "expense_date": "{expense_date}" "expense_name": "{expense_name}" "project": "{project}" "category": "{category}" "amount": {amount} "note": "{note}" "type": "{type}" "added_date": "{added_date}" }, {...} ]
You can create a new expense using
Copy code POST https://www.webwork-tracker.com/rest-api/expenses
Below you can see all parameters that you can pass to request body
Property name | Type | Is required |
---|---|---|
expense_name | string | Yes |
date | date | Yes |
amount | numeric | Yes |
category_id | string | Yes |
project_id | integer | No |
note | string | No |
is_billable | boolean | No |
The returned response includes a success
property which contains your request
success value, and expense
property which is an array of the created expense options.
Copy code { "success": "{success_of_the_request}" "expense": "{expense_array}" }
You can update a expense by sending
Copy code PUT https://www.webwork-tracker.com/rest-api/expenses/{expense_id}
You should put the following header in your request
Copy code Content-Type: application/x-www-form-urlencoded
You can use
Property name | Type | Is required |
---|---|---|
expense_name | string | YES |
project_id | integer | no |
date | date | no |
amount | numeric | no |
category_id | string | no |
project_id | integer | no |
note | string | no |
is_billable | boolean | no |
The returned response contains a success
property with your request success value.
Copy code { "success": "{success_of_the_request}" }
To delete a expense, you should send a request to the same URL using
Copy code DELETE https://www.webwork-tracker.com/rest-api/expenses/{expense_id}
The returned response includes a success
property which contains your request
success value.
Copy code { "success": "{success_of_the_request}" }
You can get all the expenses categories in your workspace with the following URL request
Copy code GET https://www.webwork-tracker.com/rest-api/expenses/categories
Retrieves a list of categories in your workspace. By default, results are paginated (50 rows per page), and you can optionally filter categories by including any combination of the following query parameters.
Copy code GET https://www.webwork-tracker.com/rest-api/expenses/categories?id={id}&page={page}
The response returns a json format. Below you can see an example of response structure.
Copy code max_rows: "{max_rows}" current_page: "{current_page}" total_pages: "{total_pages}" data: [ { "id": "{id}" "name": "{name}" }, {...} ]