Skip to content

Commit c0701e5

Browse files
committed
Object + list + filter + get docs
1 parent 8193c2f commit c0701e5

11 files changed

+208
-0
lines changed

pages/api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ endpoint_sections:
5454
title: Appointments (Lessons)
5555
id: appointments
5656
layout: /appointments/appointments.yml
57+
-
58+
title: Balance Updates
59+
id: balance_updates
60+
layout: /balance_updates/balance_updates.yml
5761
-
5862
title: Branch
5963
id: branch
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"id": 191,
3+
"client": {
4+
"id": 60,
5+
"first_name": "Ana",
6+
"last_name": "Oliver",
7+
"email": "[email protected]",
8+
"role_type": "Tutor",
9+
"url": "https://secure.tutorcruncher.com/api/contractors/60/"
10+
},
11+
"created": "2025-09-25T09:55:20.489121+01:00",
12+
"creator": {
13+
"id": 6,
14+
"first_name": "Thomas",
15+
"last_name": "Jackson",
16+
"email": "[email protected]",
17+
"role_type": "Administrator"
18+
},
19+
"credit_amount": "135.00",
20+
"description": "Payment Order raised",
21+
"method": "auto",
22+
"method_display": "System Generated",
23+
"related_item": {
24+
"id": 46,
25+
"display_id": "PO-46",
26+
"date_sent": "2025-09-25T09:55:20.442900+01:00",
27+
"amount": "135.00",
28+
"payee": {
29+
"id": 60,
30+
"first_name": "Ana",
31+
"last_name": "Oliver",
32+
"email": "[email protected]",
33+
"role_type": "Tutor",
34+
"url": "https://secure.tutorcruncher.com/api/contractors/60/"
35+
},
36+
"status": "unpaid",
37+
"url": "https://secure.tutorcruncher.com/api/payment-orders/46/"
38+
},
39+
"update_type": "po_creation",
40+
"update_type_display": "Payment Order Creation"
41+
}
42+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Balance Update Object
2+
3+
A Balance Update represents a change in a Client's balance. It can be created manually by an admin or automatically
4+
when certain actions occur, such as when a payment is processed.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
attributes:
2+
-
3+
name: id
4+
type: integer
5+
description: Unique identifier for the balance update.
6+
-
7+
name: client
8+
type: object
9+
description: The client whose balance is being updated.
10+
-
11+
name: created
12+
type: datetime
13+
description: The date and time when the balance update was created.
14+
-
15+
name: creator
16+
type: object
17+
description: The user who created this balance update.
18+
-
19+
name: credit_amount
20+
type: decimal
21+
description: The amount of credit being added or removed from the client's balance.
22+
-
23+
name: description
24+
type: string
25+
description: A description explaining the reason for the balance update.
26+
-
27+
name: method
28+
type: string
29+
description: The payment method used for the balance update. Options for this field are ['cash', 'cheque', 'credit_card', 'transferwise', 'debit_card', 'bank_transfer', 'direct_debit', 'bonus_credit', 'manual', 'voucher', 'correction'].
30+
-
31+
name: method_display
32+
type: string
33+
description: Human-readable display name for the payment method.
34+
-
35+
name: related_item
36+
type: object
37+
description: Any related object that this balance update is associated with (nullable).
38+
-
39+
name: update_type
40+
type: string
41+
description: The type of update being performed (e.g., "via_api", "manual").
42+
-
43+
name: update_type_display
44+
type: string
45+
description: Human-readable display name for the update type.
46+
47+
filters:
48+
-
49+
name: client
50+
type: integer
51+
description: Filter by the Balance Updates linked Client (id).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
sections:
2+
-
3+
title: Balance Update Object
4+
id: balance-update-object
5+
description: /balance_updates/balance-update-object.md
6+
attributes: /balance_updates/balance-update-object.yml
7+
response: /balance_updates/balance-update-object.json
8+
response_title: OBJECT
9+
-
10+
title: List all Balance Updates
11+
id: list-all-balance-updates
12+
description: /balance_updates/list-all-balance-updates.md
13+
filters: /balance_updates/balance-update-object.yml
14+
code: /balance_updates/list-all-balance-updates.py
15+
code_type: GET
16+
code_url: /api/balance_updates/
17+
response: /balance_updates/list-all-balance-updates.json
18+
-
19+
title: Get a balance update
20+
id: get-a-balance-update
21+
description: /balance_updates/get-a-balance-update.md
22+
code: /balance_updates/get-a-balance-update.py
23+
code_type: GET
24+
code_url: /api/balance_updates/{id}/
25+
response: /balance_updates/get-a-balance-update.json
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"id": 191,
3+
"client": {
4+
"id": 60,
5+
"first_name": "Ana",
6+
"last_name": "Oliver",
7+
"email": "[email protected]",
8+
"role_type": "Tutor",
9+
"url": "https://secure.tutorcruncher.com/api/contractors/60/"
10+
},
11+
"created": "2025-09-25T09:55:20.489121+01:00",
12+
"creator": {
13+
"id": 6,
14+
"first_name": "Thomas",
15+
"last_name": "Jackson",
16+
"email": "[email protected]",
17+
"role_type": "Administrator"
18+
},
19+
"credit_amount": "135.00",
20+
"description": "Payment Order raised",
21+
"method": "auto",
22+
"method_display": "System Generated",
23+
"related_item": {
24+
"id": 46,
25+
"display_id": "PO-46",
26+
"date_sent": "2025-09-25T09:55:20.442900+01:00",
27+
"amount": "135.00",
28+
"payee": {
29+
"id": 60,
30+
"first_name": "Ana",
31+
"last_name": "Oliver",
32+
"email": "[email protected]",
33+
"role_type": "Tutor",
34+
"url": "https://secure.tutorcruncher.com/api/contractors/60/"
35+
},
36+
"status": "unpaid",
37+
"url": "https://secure.tutorcruncher.com/api/payment-orders/46/"
38+
},
39+
"update_type": "po_creation",
40+
"update_type_display": "Payment Order Creation"
41+
}
42+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Get a Balance Update
2+
3+
Returns the details of an existing Balance Update. You only need to specify the unique `id` of the Balance Update to get the correct details.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pprint, requests
2+
3+
headers = {'Authorization': 'token <API KEY>'}
4+
r = requests.get('https://secure.tutorcruncher.com/api/balance_updates/<id>/', headers=headers)
5+
pprint.pprint(r.json())
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"count": 1,
3+
"next": null,
4+
"previous": null,
5+
"results": [
6+
{
7+
"id": 191,
8+
"client": {
9+
"id": 60,
10+
"first_name": "Ana",
11+
"last_name": "Oliver",
12+
"email": "[email protected]",
13+
"role_type": "Tutor",
14+
"url": "https://secure.tutorcruncher.com/api/contractors/60/"
15+
},
16+
"created": "2025-09-25T09:55:20.489121+01:00",
17+
"credit_amount": "135.00",
18+
"method_display": "System Generated",
19+
"update_type_display": "Payment Order Creation",
20+
"url": "https://secure.tutorcruncher.com/api/balance-updates/191/"
21+
}
22+
]
23+
}
24+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### List all Balance Updates
2+
3+
Returns a list of all your Balance Updates. The Balance Updates are sorted by date created, with the most recently created first.

0 commit comments

Comments
 (0)