Skip to content

Commit 54c3935

Browse files
authored
Merge pull request #179 from tutorcruncher/countries-endpoint
added countries endpoint api docs
2 parents d7e69f9 + 8696f22 commit 54c3935

11 files changed

+118
-0
lines changed

data/actions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,13 @@
903903
"help_text": "When an Administrator exports data about Users.",
904904
"subject_types": []
905905
},
906+
{
907+
"key": "CLIENTS_EXPORT",
908+
"value": "CLIENTS_EXPORT",
909+
"msg": "Exported Clients",
910+
"help_text": "When an Administrator exports data about Clients.",
911+
"subject_types": []
912+
},
906913
{
907914
"key": "EDITED_SYSTEM_SETTINGS",
908915
"value": "EDITED_SYSTEM_SETTINGS",

pages/api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ endpoint_sections:
5858
title: Contractors (Tutors)
5959
id: contractors
6060
layout: /contractors/contractors.yml
61+
-
62+
title: Countries
63+
id: countries
64+
layout: /countries/countries.yml
6165
-
6266
title: Enquiry
6367
id: enquiry

pages/countries/countries.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
sections:
2+
-
3+
title: Country Object
4+
id: country-object
5+
description: /countries/country-object.md
6+
attributes: /countries/country-object.yml
7+
response: /countries/get-a-country.json
8+
response_title: OBJECT
9+
-
10+
title: List all Countries
11+
id: list-all-countries
12+
description: /countries/list-all-countries.md
13+
code: /countries/list-all-countries.py
14+
code_type: GET
15+
code_url: /api/countries/
16+
response: /countries/list-all-countries.json
17+
-
18+
title: Get a Country
19+
id: get-a-country
20+
description: /countries/get-a-country.md
21+
code: /countries/get-a-country.py
22+
code_type: GET
23+
code_url: /api/countries/<id>/
24+
response: /countries/get-a-country.json

pages/countries/country-object.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Country Object
2+
3+
The country object id is used, when creating and updating the user model. The country object is used to define the country of the user.

pages/countries/country-object.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
attributes:
2+
-
3+
name: id
4+
type: integer
5+
description: Unique identifier for the object.
6+
-
7+
name: name
8+
type: string
9+
description: The name of the country.
10+
-
11+
name: abbreviation
12+
type: string
13+
description: The abbreviation of the country.
14+
-
15+
name: three_letter_iso
16+
type: string
17+
description: The three-letter ISO code for the country.
18+
-
19+
name: currency
20+
type: string
21+
description: The currency used in the country; e.g Pounds Sterling (£).
22+
-
23+
name: url
24+
type: string
25+
description: The URL of the country's object.

pages/countries/get-a-country.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"id": 183,
3+
"name": "United Kingdom",
4+
"abbreviation": "GB",
5+
"three_letter_iso": "GBR",
6+
"currency": "Pounds Sterling (£)"
7+
}

pages/countries/get-a-country.md

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

pages/countries/get-a-country.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/countries/<id>/', headers=headers)
5+
pprint.pprint(r.json())
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"count": 4,
3+
"next": null,
4+
"previous": null,
5+
"results": [
6+
{
7+
"id": 3,
8+
"name": "Afghanistan",
9+
"url": "http://localhost:8000/api/countries/3/"
10+
},
11+
{
12+
"id": 5,
13+
"name": "Albania",
14+
"url": "http://localhost:8000/api/countries/5/"
15+
},
16+
{
17+
"id": 48,
18+
"name": "Algeria",
19+
"url": "http://localhost:8000/api/countries/48/"
20+
},
21+
{
22+
"id": 1,
23+
"name": "Andorra",
24+
"url": "http://localhost:8000/api/countries/1/"
25+
},
26+
{
27+
"id": 7,
28+
"name": "Angola",
29+
"url": "http://localhost:8000/api/countries/7/"
30+
}
31+
]
32+
}

pages/countries/list-all-countries.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### List all Countries
2+
3+
Returns a list of your countries. The countries are sorted by name, alphabetically.

0 commit comments

Comments
 (0)