Skip to content

Latest commit

 

History

History
150 lines (129 loc) · 3.98 KB

user.md

File metadata and controls

150 lines (129 loc) · 3.98 KB

Back to main

User

Add User
Remove User
Get All Classes From Teachers
Get All Users
Get User Info

Endpoint: /User

Add User

Back to the top

POST

Expected Request

{
    "body": {
        "firstname": "Trey",
        "lastname": "Davis",
        "user_password": "password3",
        "email": "[email protected]",
        "role_id": 0,
        "grade": 11
    },
    "action": "add_user"
}


Variable Data Type Required Additional Validation
firstname string True No
lastname string True No
user_password string True Minimum 8 characters. At least one letter and at least one number
email string True Looks for something like [email protected]
role integer True Looking for a valid role_id. Currently that's something from 0-3


Expected Response:

Healthy Call

{
    "message": "User added"
}

Unhealthy Call

{
    "error": "error message"
}

Remove User

Back to the top

DELETE /api/user/remove_user

Expected Request ?user_id=559&action=remove_user


Variable Data Type Required Additional Validation
user_id integer True No


Expected Response:

Healthy Call

{
    "message": "User Removed"
}

Unhealthy Call

{
    "error": "error message"
}

Get All Classes From User

Back to the top

GET

Expected Request ?user_id=6&action=get_all_classes_of_user

Variable Data Type Required Additional Validation
user_id integer True No


Expected Response:

Healthy Call

{
    "message": "a list of all the class data for the user"
}

Unhealthy Call

{
    "error": "error message"
}

Get All Users

Back to the top

GET

Expected Request: ?role_id=-1&action=get_all_users


Variable Data Type Required Additional Validation
role_id integer True No


Expected Response:

Healthy Call

{
    "message": "a list of all of the users if role id = -1, filtered by role if role_id is a valid role"
}

Unhealthy Call

{
    "error": "error message"
}

Get User Info

Back to the top

GET

Expected Request: ?user_id=6&action=get_user_info


Variable Data Type Required Additional Validation
user_id integer False No


Expected Response:

Healthy Call

{
    "message": "All user info from one user"
}

Unhealthy Call

{
    "error": "error message"
}