Repository navigation
Replies: 2 comments
|
This is done and will be in the next release. Every transaction in the API now has a While I was at it there are also more filters on |
|
Setting tags is in now as well, it's on dev for the next release. |
Uh oh!
There was an error while loading. Please reload this page.
Proposal: expose tags through the public Budget API
Background
The public API at
/ocs/v2.php/apps/budget/api/v1provides accounts, categories and transactions. Transactions in the Budget web interface can also have tags. Those tags are currently not available through the public API.As a result, external clients cannot render a transaction completely: they receive its amount, vendor, description and category, but not the user-assigned tags.
Requested extension
Please include a transaction's tags as an additional field in the existing read responses:
GET /transactionsGET /transactions/{id}Proposed format:
{ "id": 20070, "description": "Einkauf", "vendor": "Beispielmarkt", "amount": "42.50", "type": "debit", "tags": [ { "id": 12, "name": "Haushalt" }, { "id": 27, "name": "Beleg geprüft" } ] }For transactions without tags, the field should always be returned as an empty array:
"tags": []The field should not be omitted or be
null. This lets clients render and filter tags without special handling.Optional list endpoint
To allow clients to discover tags independently of existing transactions, an additional read endpoint would be useful:
Example response:
[ { "id": 12, "name": "Haushalt" }, { "id": 27, "name": "Beleg geprüft" } ]If tags in Budget have other stable presentation data, such as a colour or sort order, those can be added as optional fields.
API contract and split transactions
Tags belong to the whole transaction, not to individual parts of a split transaction. Therefore,
tagsshould exist only on the transaction object and should not be repeated on entries insplits.This change is backward compatible: existing clients can ignore the new field while newer clients can display the tags.
Future extension: setting tags when creating a transaction
As a second step, it would be useful to extend
POST /transactionswith an optionaltag_idsfield. With form data, the value could be sent as a JSON array:The API should reject unknown or inaccessible IDs with
400. This write feature is not required to display tags in a first iteration.@otherworld-dev
All reactions