Update
Partial update of a transaction
POST https://do.workzeal.com/finance/update
Only the passed fields are changed; everything else in the transaction stays as it was. The modification date and the author of the change are set automatically.
Request Body
| Name | Type | Description |
|---|---|---|
| transaction* | JSON |
200: OK Standard response object
{
"status": "success",
"error": "",
"code": null,
"rows": 0,
"pages": 0,
"page": 0,
"value": "1"
}
JSON
All available parameters
- id - * Transaction ID
- sum - Amount in the base currency
- category_id - Income/expense category ID
- account_id - Account ID
- direction_id - Direction: 1 - receipt, 2 - expense
- type_id - Payment method ID
- company_id - Client ID
- deal_id - Deal ID
- date - Date/time of the transaction
- note - Note (replaces the old one)
- user_id - Responsible person ID
- tags - Comma-separated tags (replace the old ones)
{
"id": 70012,
"sum": 175000,
"note": "Payment for invoice 145 from Prodstar, additional payment of 25,000"
}
Note
Required parameter: only id (transaction ID) plus at least one field to update.
Numeric fields with the value 0 are treated as "not passed", so the amount cannot be set to zero, while note and tags, when passed, completely replace the old value.
Example
cURL
NodeJS (Request)
curl --location --request POST 'https://do.workzeal.com/finance/update' \
--header 'Authorization: Bearer XXXX-XXXXXXX-XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 70012,
"sum": 175000
}
'
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://do.workzeal.com/finance/update',
'headers': {
'Authorization': 'Bearer XXXX-XXXXXXX-XXXXXXX',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"id": 70012,
"sum": 175000
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Response
{
"status": "success",
"error": "",
"code": null,
"rows": 0,
"pages": 0,
"page": 0,
"value": "1"
}
// value: 1 - the transaction was updated, 0 - error (the text is in the error field)