API.md 705 Bytes
Newer Older
1
2
3
API
========

4
## Location
Florent Chehab's avatar
Florent Chehab committed
5

6
The backend `Django` app, with `Django Rest Framework` acts as an API. It is available at the URI `/api`.
Florent Chehab's avatar
Florent Chehab committed
7

8
An automated documentation is generated and available at the URI `/api-docs`.
Florent Chehab's avatar
Florent Chehab committed
9
10


11
## Authentication
Florent Chehab's avatar
Florent Chehab committed
12

13
Two authentication protocol are currently available and both lead to API response according to the rights of the corresponding user.
Florent Chehab's avatar
Florent Chehab committed
14
15
16
17


### Session

18
This is the default mode used once you are connected with the `CAS` by going to the URI `/user/login`.
Florent Chehab's avatar
Florent Chehab committed
19
20
21
22


### Token

23
A token may be associated with a user through the Django admin (`/admin`). To use it you could do:
Florent Chehab's avatar
Florent Chehab committed
24
25

```bash
26
curl -X GET http://127.0.0.1:8000/api/country/ -H 'Authorization: Token MyTokenRandomSuperLong'
Florent Chehab's avatar
Florent Chehab committed
27
```