Skip to content

Commit 79ab244

Browse files
authored
Merge pull request #194 from tutorcruncher/contractor-skills-api
Contractor Skill API Doc
2 parents 5ebf37c + 846f17a commit 79ab244

20 files changed

+435
-34
lines changed

pages/api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ endpoint_sections:
6666
title: Contractors (Tutors)
6767
id: contractors
6868
layout: /contractors/contractors.yml
69+
-
70+
title: Contractor Skills
71+
id: contractor-skills
72+
layout: /contractor-skills/contractor-skills.yml
6973
-
7074
title: Countries
7175
id: countries
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": 2,
3+
"contractor": {
4+
"id": 52,
5+
"first_name": "James",
6+
"last_name": "Higgins",
7+
"email": "[email protected]",
8+
"url": "https://secure.tutorcruncher.com/api/contractors/52/"
9+
},
10+
"subject": {
11+
"id": 159,
12+
"name": "PGCE",
13+
"category_id": 15,
14+
"category_name": "Teaching Skill",
15+
"custom_to_branch": null
16+
},
17+
"qual_level": {
18+
"id": 14,
19+
"name": "BA",
20+
"ranking": 50.0,
21+
"custom_to_branch": null
22+
}
23+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Contractor Skills Object
2+
3+
A Contractor Skills object represents the relationship between a Contractor and a Skill. A Skill is defined by a combination of a [Subject](#subjects) and a [Qualification Level](#qual-level). For example, a Skill might be "Mathematics (A Level)" where "Mathematics" is the Subject and "A Level" is the Qualification Level.
4+
5+
When you retrieve a Contractor Skill, you'll get the basic details of the Contractor, along with the associated Subject and Qualification Level information. This allows you to see not just which skills a Contractor has, but also the specific Qualification Levels for each subject they can teach.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
attributes:
2+
-
3+
name: id
4+
type: integer
5+
description: Unique identifier for the contractor skill object.
6+
-
7+
name: contractor
8+
type: object
9+
description: The contractor this skill is associated with.
10+
children:
11+
-
12+
name: id
13+
type: integer
14+
description: Unique identifier for the contractor.
15+
-
16+
name: first_name
17+
type: string
18+
description: The contractor's first name.
19+
-
20+
name: last_name
21+
type: string
22+
description: The contractor's last name.
23+
-
24+
name: email
25+
type: string
26+
description: The contractor's email address.
27+
-
28+
name: url
29+
type: string
30+
description: API URL for the full contractor details.
31+
-
32+
name: subject
33+
type: object
34+
description: The subject details.
35+
children:
36+
-
37+
name: id
38+
type: integer
39+
description: Unique identifier for the subject.
40+
-
41+
name: name
42+
type: string
43+
description: Name of the subject.
44+
-
45+
name: category_id
46+
type: integer
47+
description: ID of the subject category.
48+
-
49+
name: category_name
50+
type: string
51+
description: Name of the subject category.
52+
-
53+
name: custom_to_branch
54+
type: bool
55+
description: Indicates whether the Subject is custom to your Branch (True), or is a default Subject (null).
56+
-
57+
name: qual_level
58+
type: object
59+
description: The qualification level details.
60+
children:
61+
-
62+
name: id
63+
type: integer
64+
description: Unique identifier for the qualification level.
65+
-
66+
name: name
67+
type: string
68+
description: Name of the qualification level.
69+
-
70+
name: ranking
71+
type: decimal
72+
description: Numerical ranking of the qualification level.
73+
-
74+
name: custom_to_branch
75+
type: bool
76+
description: Indicates whether the Qualification Level is custom to your Branch (True), or is a default Qualification Level (null).
77+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
sections:
2+
-
3+
title: Contractor Skills Object
4+
id: contractor-skills-object
5+
description: /contractor-skills/contractor-skills-object.md
6+
attributes: /contractor-skills/contractor-skills-object.yml
7+
response: /contractor-skills/contractor-skills-object.json
8+
response_title: OBJECT
9+
-
10+
title: List all Contractor Skills
11+
id: list-all-contractor-skills
12+
description: /contractor-skills/list-all-contractor-skills.md
13+
code: /contractor-skills/list-all-contractor-skills.py
14+
code_type: GET
15+
code_url: /api/contractor-skills/
16+
response: /contractor-skills/list-all-contractor-skills.json
17+
-
18+
title: Get a Contractor Skill
19+
id: get-a-contractor-skill
20+
description: /contractor-skills/get-a-contractor-skill.md
21+
code: /contractor-skills/get-a-contractor-skill.py
22+
code_type: GET
23+
code_url: /api/contractor-skills/<id>/
24+
response: /contractor-skills/get-a-contractor-skill.json
25+
-
26+
title: Create a Contractor Skill
27+
id: create-a-contractor-skills
28+
description: /contractor-skills/create-a-contractor-skill.md
29+
code: /contractor-skills/create-a-contractor-skill.py
30+
code_type: POST
31+
code_url: /api/contractor-skills/
32+
response: /contractor-skills/create-a-contractor-skill.json
33+
-
34+
title: Delete a Contractor Skill
35+
id: delete-a-contractor-skill
36+
description: /contractor-skills/delete-a-contractor-skill.md
37+
code: /contractor-skills/delete-a-contractor-skill.py
38+
code_type: DELETE
39+
code_url: /api/contractor-skills/<id>/
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": 135,
3+
"contractor": {
4+
"id": 69,
5+
"first_name": "Billy",
6+
"last_name": "Holiday",
7+
"email": null,
8+
"url": "https://secure.tutorcruncher.com/api/69/"
9+
},
10+
"subject": {
11+
"id": 51,
12+
"name": "Religious Studies",
13+
"category_id": 8,
14+
"category_name": "Humanities",
15+
"custom_to_branch": null
16+
},
17+
"qual_level": {
18+
"id": 13,
19+
"name": "Key Stage 5",
20+
"ranking": 35.0,
21+
"custom_to_branch": null
22+
}
23+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Add a Contractor Skill
2+
3+
Creates a new Contractor Skill, representing a relationship between a Contractor and a combination of [Subject](#subjects) and [Qualification Level](#qual-levels). You need to provide the `contractor`, `subject`, and `qual_level` IDs in the request body. Subjects or Qualification Levels custom to another branch, hidden for the branch, or added specifically by the Contractor cannot be used. For more information about what “custom to branch” means, see [Subject](#subjects) and [Qualification Level](#qual-levels).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pprint, requests
2+
data = {"contractor": 69,"subject": 51,"qual_level": 13}
3+
headers = {'Authorization': 'token <API KEY>'}
4+
r = requests.post('https://secure.tutorcruncher.com/api/contractor-skills/',json=data, headers=headers)
5+
pprint.pprint(r.json())
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Delete a Contractor Skill
2+
3+
Deletes a Contractor Skill using its unique ID. Only Contractor Skills associated with your Branch can be deleted. Attempts to delete a skill that belongs to a different Branch or references a Subject or Qualification Level hidden or restricted for the Branch will result in a `400 Bad Request` response. For more information about Branch-specific restrictions, see [Subject](#subjects) and [Qualification Level](#qual-levels).
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.delete('https://secure.tutorcruncher.com/api/contractor-skills/1/', headers=headers)
5+
# Returns 204 on success

0 commit comments

Comments
 (0)