Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pages/subjects/create-a-subject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": 168,
"name": "Statistics",
"category_id": 14,
"category_name": "Science",
"custom_to_branch": true
}
3 changes: 3 additions & 0 deletions pages/subjects/create-a-subject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Create a Subject
Creates a new Subject with the given `name` and `category`, linked to your Branch.

5 changes: 5 additions & 0 deletions pages/subjects/create-a-subject.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pprint, requests
data = {"name": "Statistics", "category":14}
headers = {'Authorization': 'token <API KEY>'}
r = requests.post('https://secure.tutorcruncher.com/api/subjects/',json=data, headers=headers)
pprint.pprint(r.json())
2 changes: 2 additions & 0 deletions pages/subjects/delete-a-subject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Delete a Subject
Deletes a Subject that was created by your Branch (i.e., where `custom_to_branch`=True). Only Subjects created by your Branch can be deleted; attempting to delete a Subject not owned by your Branch will result in an error. Provide the Subject’s unique ID in the URL path.
6 changes: 6 additions & 0 deletions pages/subjects/delete-a-subject.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import pprint, requests
headers = {'Authorization': 'token <API KEY>'}
r = requests.delete('https://secure.tutorcruncher.com/api/subjects/<id>/', headers=headers)
pprint.pprint(r.json())


7 changes: 7 additions & 0 deletions pages/subjects/get-a-subject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": 168,
"name": "Statistics",
"category_id": 14,
"category_name": "Science",
"custom_to_branch": true
}
4 changes: 4 additions & 0 deletions pages/subjects/get-a-subject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Get a Subject

Returns the details of an existing Subject. You only need to specify the unique
`id` of the Subject to get the correct details.
5 changes: 5 additions & 0 deletions pages/subjects/get-a-subject.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pprint, requests

headers = {'Authorization': 'token <API KEY>'}
r = requests.get('https://secure.tutorcruncher.com/api/subjects/<id>/', headers=headers)
pprint.pprint(r.json())
3 changes: 2 additions & 1 deletion pages/subjects/list-all-subjects.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"id": 22,
"name": "Computer Science",
"category_id": 4,
"category_name": "Engineering"
"category_name": "Engineering",
"custom_to_branch": null
},
...
]
Expand Down
3 changes: 1 addition & 2 deletions pages/subjects/list-all-subjects.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
### List all Subjects

Returns of all the Subjects found on your TutorCruncher account, which are sorted by `id`,
with the largest id first.
Returns all Subjects, sorted by `id` in descending order (highest first). Includes Subjects associated with your Branch, as well as default Subjects (`custom_to_branch` = null).
3 changes: 2 additions & 1 deletion pages/subjects/subject-object.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"id": 22,
"name": "Computer Science",
"category_id": 4,
"category_name": "Engineering"
"category_name": "Engineering",
"custom_to_branch": null
}
3 changes: 1 addition & 2 deletions pages/subjects/subject-object.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
### Subject Object

Subject object contains the `id`, `name`, `category_id` and `category_name` for Subjects found
on your TutorCruncher account.
The Subject object contains the `id`, `name`, `category_id`, `category_name`, and `custom_to_branch` for Subjects associated with your Branch on your TutorCruncher account.
4 changes: 4 additions & 0 deletions pages/subjects/subject-object.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ attributes:
name: category_name
type: string
description: Name of the Subject's Category.
-
name: custom_to_branch
type: bool
description: Indicates whether the Subject is specific to your Branch (True), or is a default subject (null).

23 changes: 23 additions & 0 deletions pages/subjects/subjects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,26 @@ sections:
code_type: GET
code_url: /api/subjects/
response: /subjects/list-all-subjects.json
-
title: Get a Subject
id: get-a-subject
description: /subjects/get-a-subject.md
code: /subjects/get-a-subject.py
code_type: GET
code_url: /api/subjects/
response: /subjects/get-a-subject.json
-
title: Create a Subject
id: create-a-subject
description: /subjects/create-a-subject.md
code: /subjects/create-a-subject.py
code_type: POST
code_url: /api/subjects/
response: /subjects/create-a-subject.json
-
title: Delete a Subject
id: delete-a-subject
description: /subjects/delete-a-subject.md
code: /subjects/delete-a-subject.py
code_type: POST
code_url: /api/subjects/