Update expense

Requires authentication

HTTP Request

PUT connector/api/expense/{expense}

PATCH connector/api/expense/{expense}

Body Parameters

Parameter Type Status Description
final_total float optional Expense amount
transaction_date string optional transaction date format:Y-m-d H:i:s,
tax_rate_id integer optional id of the tax rate applicable to the expense
expense_for integer optional id of the user for which expense is created
contact_id integer optional id of the contact(customer or supplier) for which expense is created
additional_notes string optional
is_recurring integer optional whether expense is recurring (0, 1)
recur_interval integer optional value of the interval expense will be regenerated
recur_interval_type string optional type of the recur interval ('days', 'months', 'years')
subscription_repeat_on integer optional day of the month on which expense will be generated if recur interval type is months (1-30)
subscription_no string optional subscription number
recur_repetitions integer optional total number of expense to be generated
payment array optional payment lines for the expense

Example request:

curl -X PUT \
"http://erp.dstadvertising.com/connector/api/expense/1" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-d '{"final_total":291435.46333568,"transaction_date":"2020-5-7 15:20:22","tax_rate_id":1,"expense_for":6,"contact_id":2,"additional_notes":"et","is_recurring":0,"recur_interval":11,"recur_interval_type":"months","subscription_repeat_on":15,"subscription_no":"ea","recur_repetitions":18,"payment":[]}'

Example response (200):

{
"data": {
"id": 75,
"business_id": 1,
"location_id": "1",
"payment_status": "due",
"ref_no": "EP2020\/0013",
"transaction_date": "2020-07-06T05:31:29.480975Z",
"total_before_tax": "43",
"tax_id": null,
"tax_amount": 0,
"final_total": "43",
"expense_category_id": null,
"document": null,
"created_by": 1,
"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-06 11:01:29",
"updated_at": "2020-07-06 11:01:29",
"expense_for": []
}
}

javascript

const url = new URL(
"http://erp.dstadvertising.com/connector/api/expense/1"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer {token}",
};
let body = {
"final_total": 291435.46333568,
"transaction_date": "2020-5-7 15:20:22",
"tax_rate_id": 1,
"expense_for": 6,
"contact_id": 2,
"additional_notes": "et",
"is_recurring": 0,
"recur_interval": 11,
"recur_interval_type": "months",
"subscription_repeat_on": 15,
"subscription_no": "ea",
"recur_repetitions": 18,
"payment": []
}
fetch(url, {
method: "PUT",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));