Sign Up

Create User

Function: create_user Type: API Endpoint (POST)

Purpose:
This function creates a new user in the database. It generates a unique user code based on the provided LSCode and other parameters, checks if the user email already exists, encrypts the password, and adds the new user to the database.

URL:
POST /api/registration/create_user

Request Body:

  • application_code (string, required):
    The application code for the user.
  • lscode (string, required):
    The LSCode for the user.
  • email (string, required):
    The email address of the user.
  • mobile (string, required):
    The mobile number of the user.
  • password (string, required):
    The password for the user.
  • is_administrator (boolean, optional):
    Whether the user is an administrator or not (default is False).
  • user_group_code (string, required):
    The user group code for the user.
  • default_firm (string, required):
    The default firm for the user.
  • is_license (boolean, optional):
    Whether the user is a licensed user or not (default is True).
  • is_support_admin (boolean, optional):
    Whether the user is a support administrator or not (default is False).
  • created_by (string, required):
    The user who created the user.

Response:

  • message (string):
    A success message if the user is created successfully.
  • user (object):
    The newly created user object.

Error Handling:

  • If a user with the provided email already exists, the function raises an HTTPException with a 400 status code and an error message.
  • If any other error occurs during database operations, the function returns a 500 error with the error message.
post/api/registration/create_user

Request body

application_codestring required
lscodestring required
send_notificationboolean
first_namestring required
last_namestring required
emailstring required
mobilestring required
passwordstring required
is_administratorboolean
is_licenseboolean
two_factor_authboolean
is_support_adminboolean
user_group_codestring required
created_bystring required
default_firmstring
is_groupinteger
user_activeboolean
access_sync_appboolean

Response

Successful Response

{"stackTrail":"paths:/api/registration/create_user:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}

Changes