List expenses
The following macros are not currently supported in the header:
  • style

List expenses

Resource URL

Returns an array of expenses.

GET /expenses ANY /expenses?_method=get

Parameters

Table of allowed parameters.

_page

unsigned int

The page of the list to display. For example, 5 will display the fifth page. Each page contains 10 resources.

_limit

unsigned int

The maximum number of resources to return. Default is 10 and maximum is 50.

_offset

unsigned int

The position in the list of resources to return from. For example, if you had 20 resources and requested an offset of 10. Resources 10 to 19 would be returned. Offset cannot be used in conjunction with _page.

_fields

partial string

Allows you to specify optional fields and linked objects to include in the response.

Filtering expense

You can filter the returned list using the _filters parameter. You can stack filters. For example,_filters=id(21,3),type(1,2),standing(active)



Name

Example

Description

Name

Example

Description

id(...) or id_not(...)

_filters=id(12,3)



type(...) or type_not(...)

_filters=type(1, 2)



submitter(...) or submitter_not(...)

_filters=submitter(1,2)



approver (...) or approver_not(...)

_filters=approver (1,2)



standing(...) or standing_not(...)

_filters=standing(approved)

Where standing can be 'submitted', 'approved' or 'declined'. You cannot filter by "invoiced" yet. 

against(type1(...),typeN(...))

_filters=against(job(1,4), issue(2,4))

Only return expenses with the matching against values. The example will only return expenses against job 1 and 4 or expenses against issue 1 and 4.

date_type_<before|after> (unix timestamp)

_filters=date_incurred_before(1430400000)

Accepts a unix timestamp. It will then filter expenses that have a timestamp before the supplied one. This supports types: inccured. For example, date_incurred_before(<todays timestamp>) would only return expenses completed before today.

<field_name>_greater_than(<value>),

<field_name>_less_than(<value>),

<field_name>_greater_than_or_equal(<value>),

<field_name>_less_than_or_equal(<value>)



_filters=id_greater_than(5)

Available fields:

id, type, submitter, approver, quantity, unit_cost and cost

order_by_asc(<type>), order_by_desc(<type>)



_filters=order_by_asc(id)

Accepts: id, date_incurred, title, standing, quantity and unit_cost

against_type(<types>), against_id(<ids)

_filters=against_type(job,issue)

Filter expenses by generic against types and id. For example, you would use the against type filter if you only wanted expenses on jobs.

Handling the response

For handling the response, please see GET /expenses/:id.

Sample Response

GET /expenses.json?_fields=submitter(id)
{ "meta": { "message": "Everything executed as expected.", "status": "ok", "more_info": "https://affinitylive.jira.com/wiki/display/APIS/Status+Codes#ok" }, "response": { "expenses": [ { "title": "yaeh", "id": "15", "quantity": "1", "submitter": { "id": "122", "firstname": "Hugh", "surname": "Cowling" }, "standing": "submitted", "unit_cost": "32.00" }, { "quantity": "2", "id": "18", "title": "Child's play", "standing": "approved", "unit_cost": "2.47", "submitter": { "surname": "Cowling", "firstname": "Hugh", "id": "122" } }, { "title": "test111", "quantity": "1", "id": "24", "standing": "submitted", "unit_cost": "1.00", "submitter": { "surname": "Cowling", "firstname": "Hugh", "id": "122" } } ] } }