Skip to content

Commit 349f035

Browse files
committed
Creating a balance update docs
1 parent c0701e5 commit 349f035

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

pages/balance_updates/balance_updates.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ sections:
2323
code_type: GET
2424
code_url: /api/balance_updates/{id}/
2525
response: /balance_updates/get-a-balance-update.json
26+
-
27+
title: Create a balance update
28+
id: create-a-balance-update
29+
description: /balance_updates/create-a-balance-update.md
30+
code: /balance_updates/create-a-balance-update.py
31+
code_type: POST
32+
code_url: /api/balance_updates/
33+
response: /balance_updates/create-a-balance-update.json
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"id": 385,
3+
"client": {
4+
"id": 67,
5+
"first_name": "Billy",
6+
"last_name": "Holiday",
7+
"email": "[email protected]",
8+
"role_type": "Client",
9+
"url": "http://localhost:8000/api/clients/67/"
10+
},
11+
"created": "2025-09-25T10:00:00.000000+01:00",
12+
"creator": {
13+
"id": 64,
14+
"first_name": "Billy",
15+
"last_name": "Holiday",
16+
"email": "[email protected]",
17+
"role_type": "Administrator"
18+
},
19+
"credit_amount": "100.00",
20+
"description": "This is a test description about why the credit was added to this client",
21+
"method": "cash",
22+
"method_display": "Cash",
23+
"related_item": null,
24+
"update_type": "via_api",
25+
"update_type_display": "Via API"
26+
}
27+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### Creating a Balance Update
2+
3+
Creating a Balance Update can be completed by simply supplying the `client`, `credit_amount` and `method` as the
4+
`description` field is optional. The `credit_amount` field must always be a positive value, however if the method is
5+
set to `"correction"` then `credit_amount` can be a negative value.
6+
7+
The possible values for the `method` field are:
8+
`cash`, `cheque`, `credit_card`, `transferwise`, `debit_card`, `bank_transfer`, `direct_debit`, `bonus_credit`,
9+
`manual`, `voucher`, `correction`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pprint, requests
2+
3+
headers = {'Authorization': 'token <API KEY>'}
4+
data = {
5+
"client": 67,
6+
"credit_amount": 100,
7+
"method": "cash",
8+
"description": "Client paid by cash.",
9+
}
10+
response = requests.post('https://secure.tutorcruncher.com/api/balance_updates/', json=data, headers=headers)
11+
pprint.pprint(response.json())

0 commit comments

Comments
 (0)