Repository navigation
User API Doc
Method: POST
Description: This method is used to login (be allocated a JWT token) a user with the specified username and password
Body Input
| Parameters | Format |
|---|---|
| login | LoginDTO Object |
Request Body example
{
"username": "string"
"password": "string"
}
example request URL: https://localhost:5001/api/User/login
STATUS CODE: 404 NOT FOUND No username exists
STATUS CODE: 403 FORBIDDEN Incorrect password
STATUS CODE: 200 OK Successful login
{
"userName": "string",
"token": "<JWT token here>"
}
Method: POST
Description: Confirm if the given reset password token for a user is valid
Body Input
| Parameters | Format |
|---|---|
| resetPassword | ResetPasswordDTO Object |
Request Body example
{
"email": "string"
"resetToken": "<reset token here>"
}
example request URL: https://localhost:5001/api/User/resetTokenCheck
STATUS CODE: 400 Bad Request No reset token exists
STATUS CODE: 200 OK Reset token exists
Method: POST
Description: Update the given user's password
Body Input
| Parameters | Format |
|---|---|
| login | LoginDto Object |
Request Body example
{
"email": "string"
"password": "string"
}
example request URL: https://localhost:5001/api/User/resetPassWord
STATUS CODE: 404 NOT FOUND No username exists
STATUS CODE: 400 BAD REQUEST User does not have valid password change request
STATUS CODE: 200 OK Password successfully reset
Method: POST
Description: Send reset password link to user's E-mail
Body Input
| Parameters | Format |
|---|---|
| forgotPass | ForgotPassRequestDTO Object |
Request Body example
{
"userOrEmail": "string"
}
example request URL: https://localhost:5001/api/User/forgotPassword
STATUS CODE: 404 NOT FOUND Invalid username/email sent
STATUS CODE: 200 OK
{
"email": "string",
"resetToken": "<Password reset token>"
}
Method: POST
Description: Checks if an account with the specified username or email exists
Body Input
| Parameters | Format |
|---|---|
| registerRequest | RegisterRequestDTO Object |
Request Body examples
{
"userName": "string"
"email": "string"
}
example request URL: https://localhost:5001/api/User/check
STATUS CODE: 400 BAD REQUEST username already exists
STATUS CODE: 409 CONFLICT email already exists
STATUS CODE: 200 OK username and password available
Method: POST
Description: Registers a user with the specified parameters
Body Input
| Parameters | Format |
|---|---|
| registerRequest | RegisterRequestDTO Object |
Request Body examples
{
"userName": "string",
"firstName": "string",
"lastName": "string",
"dateOfBirth": "2020-03-16T04:25:50.783Z",
"phoneNumber": "0",
"email": "string",
"medicalInformation": "string",
"bankAccount": "string",
"password": "string"
}
example request URL: https://localhost:5001/api/User/register
STATUS CODE: 400 BAD REQUEST username, email, phoneNumber or password are strings empty
STATUS CODE: 409 CONFLICT username, email or phoneNumber already used in database
STATUS CODE: 200 OK account was created
{
"userName": "string",
"token": "<JWT token here>"
}
Method: GET
Description: This method is used to get the user id that is associated with a user that is currently logged in
example request URL: https://localhost:5001/api/User/getCurrentUserID
STATUS CODE: 200
{
"id": 1000,
},
STATUS CODE: 401 UNAUTHORIZED No user is currently logged in
Method: GET
Description: This method is used to get the users ids based on the usernames. The API expects a JSON object with usernames as keys. Returns a JSON object with usernames and their ids as key/value pairs. If a username was not found, it is assigned a value of "0".
example request URL: https://localhost:5001/api/User/getUsersIds
STATUS CODE: 200
{
"TestUser1": "998",
"Non-existing User": "0"
},
Method: GET
Description: Gets the information of the currently logged in user
example request URL: https://localhost:5001/api/User/getUserInfo
STATUS CODE: 200
{
"id": "string",
"userName": "string",
"firstName": "string",
"lastName": "string",
"dateOfBirth": "2020-03-16T04:25:50.783Z",
"phoneNumber": "0",
"email": "string",
"medicalInformation": "string",
"bankAccount": "string"
}
STATUS CODE: 401 UNAUTHORIZED No user is currently logged in
Method: POST
Description: Updates the account details of the currently logged in user
Body Input
| Parameters | Format |
|---|---|
| info | EditUserDTO Object |
Request Body example
{
"firstName": "string",
"lastName": "string",
"dateOfBirth": "2020-03-16T04:25:50.783Z",
"phoneNumber": "0",
"email": "string",
"medicalInformation": "string",
"bankAccount": "string"
}
example request URL: https://localhost:5001/api/User/editUserInfo
STATUS CODE: 200 Success
STATUS CODE: 400 Failed
- Home
- Data Model
- Architecture
- API Documentation
- Front End Documentation
- Testing
- Prototyping
- Other
- Contributing Guidelines and Etiquitte
- Labels
- License
- Admin