List expenses

Requires authentication

HTTP Request

GET connector/api/expense

Query Parameters

Parameter Status Description
location_id optional id of the location
payment_status optional payment status
start_date optional format:Y-m-d
end_date optional format:Y-m-d
expense_for optional id of the user for which expense is created
per_page optional Total records per page. default: 10, Set -1 for no pagination

Example request:

curl -X GET \
-G "http://erp.dstadvertising.com/connector/api/expense?location_id=adipisci&payment_status=paid&start_date=2018-06-25&end_date=2018-06-25&expense_for=voluptates&per_page=15" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}"

Example response (200):

{
"data": [
{
"id": 59,
"business_id": 1,
"location_id": 1,
"payment_status": "due",
"ref_no": "EP2020\/0001",
"transaction_date": "2020-07-03 12:58:00",
"total_before_tax": "50.0000",
"tax_id": null,
"tax_amount": "0.0000",
"final_total": "50.0000",
"expense_category_id": null,
"document": null,
"created_by": 9,
"is_recurring": 0,
"recur_interval": null,
"recur_interval_type": null,
"recur_repetitions": null,
"recur_stopped_on": null,
"recur_parent_id": null,
"created_at": "2020-07-03 12:58:23",
"updated_at": "2020-07-03 12:58:24",
"transaction_for": {
"id": 1,
"user_type": "user",
"surname": "Mr",
"first_name": "Admin",
"last_name": null,
"username": "admin",
"email": "admin@example.com",
"language": "en",
"contact_no": null,
"address": null,
"business_id": 1,
"max_sales_discount_percent": null,
"allow_login": 1,
"essentials_department_id": null,
"essentials_designation_id": null,
"status": "active",
"crm_contact_id": null,
"is_cmmsn_agnt": 0,
"cmmsn_percent": "0.00",
"selected_contacts": 0,
"dob": null,
"gender": null,
"marital_status": null,
"blood_group": null,
"contact_number": null,
"fb_link": null,
"twitter_link": null,
"social_media_1": null,
"social_media_2": null,
"permanent_address": null,
"current_address": null,
"guardian_name": null,
"custom_field_1": null,
"custom_field_2": null,
"custom_field_3": null,
"custom_field_4": null,
"bank_details": null,
"id_proof_name": null,
"id_proof_number": null,
"deleted_at": null,
"created_at": "2018-01-04 02:15:19",
"updated_at": "2018-01-04 02:15:19"
}
}
],
"links": {
"first": "http:\/\/local.pos.com\/connector\/api\/expense?page=1",
"last": null,
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"path": "http:\/\/local.pos.com\/connector\/api\/expense",
"per_page": 10,
"to": 1
}
}

javascript

const url = new URL(
"http://erp.dstadvertising.com/connector/api/expense"
);
let params = { "location_id": "adipisci",
"payment_status": "paid",
"start_date": "2018-06-25",
"end_date": "2018-06-25",
"expense_for": "voluptates",
"per_page": "15",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer {token}",
};
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));