API Support
Any query to the site api that requires authentication must request an authentication token and use that in each request header.
To request an authentication token you must supply an email address and password.
Method: POST
URL: https://cloud-lines-shows.com/api-token-auth/
data: "username": email_string, "password": password_string
Response: {'token': 'example_token_b2e4686cd1ea76e810f62d23db57'}
Example request (Python3)
import requests
token_res = requests.post(url='https://cloud-lines-shows.com/api-token-auth/', data={'username': 'joe.bloggs@example.com',
'password': 'SuperSecurePa55!'})
print(token_res.json()['token']}
In order to create a user you must first request an authentication token. Also note, the authenticated user must be an organiser of the specified show.
Method: POST
URL: https://cloud-lines-shows.com/api/account_admin/create_account/
Headers: 'Content-Type': 'application/json', 'Authorization': "token [token]" (no square brackets around the token)
Data(JSON):
Response: {"show": "Show [Show Name] show exists", "user": "username:[Users Full Name] created", "role": ["Judge", "Exhibitor"], "judge": ["added to judge in class [Class Name]"], "exhibitor": ["added to exhibit in class [Class Name]"]}
Example request (Python3)
import requests
headers = {'Content-Type': 'application/json', 'Authorization': f"token {token_res.json()['token']}"}
data = '{"show": "The Example Show", "role": ["judge", "exhibitor"], "judge_of": ["Best in Show - Cattle"], "exhibitor_of": ["Best in Show - Goats"], "user": {"first_name": "Joe", "last_name": "Bloggs", "email": "email@example.com"}}'
post_res = requests.post(url='http://localhost:8000/api/account_admin/create_account/',
data=data, headers=headers)
print(post_res.json())