APIs¶
POST
/users/user/new/
¶Create new user.
Parameters:
- username (str) – the user nickname. Max length 30
- first_name (str) – the user first name. Max length 50
- last_name (str) – the user last name. Max length 50
- email (str) – the user email. Max length 250
- birth_date (datetime) – the user birth date
- is_staff (boolean) – True if the user is staff member, False otherwise. Default to True
- is_active (boolean) – True if the user is active, False otherwise. Default to True
- is_admin (boolean) – True if the user has administrator privileges. Default to False
- numeric_password (int) – the user pin. String of 4 numbers
- user_type (str) – the user type: ‘AD’ for Administrative, ‘TE’ for Technician, ‘CL’ for Clinician, ‘ST’ for Student
- gender (str) – the user gender: ‘M’ for Male, ‘F’ for Female, ‘U’ for Unknown
- phone (str) – the user phone number. Max length 20
- mobile (str) – the user mobile phone number. Max length 20
- certified_email (str) – the user legal mail. Max length 255
Request Headers:
- Authorization – login required
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if the user is successfully created. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems parameter json data: if success is True, it contains the created user data in json format
POST
/users/user/login/
¶Log a user in the system
Parameters:
- username (str) – the user nickname
- password (str) – the user password
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if the user is successfully logged in. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems parameter json data: if success is True, it contains the logged user data in json format
GET
/users/user/logout/
¶Log a user out of the system
Request Headers:
- Authorization – login required
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if the user is successfully logged out. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems
GET
/users/user/
(user_id)/get_user_info/
¶Get the information of the user identified by user_id
Request Headers:
- Authorization – login required
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if the user is successfully found. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems parameter json data: if success is True, it contains the data of user identified by user_id, in json format
GET
/users/user/search/
¶Get a list of users matching a query string in fields: username, last_name, first_name, email or certified_email
Parameters:
- query_string (str) – the query string to search
Request Headers:
- Authorization – login required
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if users matching the query string are found. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems parameter json data: if success is True, it contains the a list of data of users matching the query string, in json format
POST
/users/user/
(user_id)/edit/
¶Edit the information of the user identified by user_id
Request Headers:
- Authorization – login required
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if the user is successfully found and updated. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems parameter json data: if success is True, it contains the updated data of user identified by user_id, in json format
POST
/users/user/
(user_id)/deactivate/
¶Deactivate the user identified by user_id
Request Headers:
- Authorization – login required
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if the user is successfully deactivated. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems parameter json data: if success is True, it contains the keys id (for the user id) and is_active (for the activation state):
POST
/users/user/
(user_id)/activate/
¶Activate the user identified by user_id
Request Headers:
- Authorization – login required
Response Headers:
- Content-Type –
application/json
parameter boolean success: True if the user is successfully activated. False otherwise parameter str message: a feedback string that would be displayed to the connected user parameter str errors: an error string that explains the raised problems parameter json data: if success is True, it contains the keys id (for the user id) and is_active (for the activation state)