Skip to content

Commit b68bc4a

Browse files
committed
subjects api docs
1 parent 61b9469 commit b68bc4a

14 files changed

+72
-5
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"id": 168,
3+
"name": "Statistic",
4+
"category_id": 14,
5+
"category_name": "Science",
6+
"custom_to_branch": true
7+
}

pages/subjects/create-a-subject.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Create a Subject
2+
Creates a new Subject with the given `name` and `category`, linked to the request user's Branch (`custom_to_branch`=True).
3+

pages/subjects/create-a-subject.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pprint, requests
2+
data = {"name": "Statistic", "category":14}
3+
headers = {'Authorization': 'token <API KEY>'}
4+
r = requests.post('https://secure.tutorcruncher.com/api/subjects/',json=data, headers=headers)
5+
pprint.pprint(r.json())

pages/subjects/delete-a-subject.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### Delete a Subject
2+
Deletes a Subject created by the user's Branch (`custom_to_branch`=True). Only the Subject's unique id is required in the URL. Subjects not created by the user's Branch cannot be deleted.

pages/subjects/delete-a-subject.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import pprint, requests
2+
headers = {'Authorization': 'token <API KEY>'}
3+
r = requests.delete('https://secure.tutorcruncher.com/api/subjects/<id>/', headers=headers)
4+
pprint.pprint(r.json())
5+
6+

pages/subjects/get-a-subject.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"id": 168,
3+
"name": "Statistic",
4+
"category_id": 14,
5+
"category_name": "Science",
6+
"custom_to_branch": true
7+
}

pages/subjects/get-a-subject.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Get a Subject
2+
3+
Returns the details of an existing Subject. You only need to specify the unique
4+
`id` of the Subject to get the correct details.

pages/subjects/get-a-subject.py

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/subjects/<id>/', headers=headers)
5+
pprint.pprint(r.json())

pages/subjects/list-all-subjects.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"id": 22,
88
"name": "Computer Science",
99
"category_id": 4,
10-
"category_name": "Engineering"
10+
"category_name": "Engineering",
11+
"custom_to_branch": null
1112
},
1213
...
1314
]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
### List all Subjects
22

3-
Returns of all the Subjects found on your TutorCruncher account, which are sorted by `id`,
4-
with the largest id first.
3+
Returns all Subjects, sorted by id in descending order (highest first). Includes Subjects linked to the user's Branch, as well as unassigned Subjects (custom_to_branch = null). Subjects assigned to other Branches or marked as hidden for the user's Branch are excluded.

0 commit comments

Comments
 (0)