IEEE SVU - Backend API Documentation (Dev)
This document provides the necessary details for the frontend team to integrate with the User and Authentication endpoints.
Base URL (Development)
HTTP : http://localhost:5242
HTTPS : https://localhost:7135
Authentication Flow
The system uses JWT (JSON Web Token) for authentication.
Login : Send credentials to the /api/User/login endpoint.
Token : On success, you will receive a JWT string in the data field.
Usage : For all protected endpoints, include the token in the Authorization header:
Authorization: Bearer <your_token>
Important
Refresh Tokens : Not implemented. When a token expires (default 1 hour), the API returns 401 Unauthorized. The user must log in again.
Response Wrapper
All API responses follow a consistent wrapper format:
{
"data" : T, // The actual response data (Object, String, or Boolean)
"erroCode" : 0 , // Internal error code (0 = No Error)
"message" : " ..." , // Human-readable message
"isSuccess" : true // Boolean indicating success
}
Endpoints
1. Register User
Create a new user account.
URL : /api/User/Register
Method : POST
Content-Type : multipart/form-data (Form Data)
Request Body (Fields):
Field
Type
Required
Notes
FullName
string
Yes
Email
string
Yes
Valid email format required
University
string
Yes
Password
string
Yes
Min 6 characters
ConfirmPassword
string
Yes
Must match Password
FacultyOrDepartment
string
No
Response (data):
boolean: true if registered successfully.
2. Login User
Authenticate and receive a JWT token.
URL : /api/User/login
Method : POST
Content-Type : application/json
Request Body (JSON):
{
"email" : " user@example.com" ,
"password" : " password123"
}
Response (data):
string: The JWT Access Token.
3. Get User Profile (Protected)
Retrieve the current authenticated user's profile information.
URL : /api/User/Profile
Method : GET
Authentication : Bearer Token Required
Response (data):
{
"fullName" : " John Doe" ,
"imageUrl" : " http://..." ,
"email" : " john@example.com" ,
"phoneNumber" : " 0123456789" ,
"university" : " SVU" ,
"faculty" : " Engineering" ,
"cv" : " http://..."
}
4. Edit Profile (Protected)
Update profile details, including file uploads.
URL : /api/User/editprofile
Method : PUT
Authentication : Bearer Token Required
Content-Type : multipart/form-data (Form Data)
Request Body (Fields):
Field
Type
Required
Notes
FullName
string
Yes
University
string
Yes
Faculty
string
Yes
PhoneNumber
string
No
Image
File
No
Image file to upload
CV
File
No
PDF/Doc file to upload
DeleteImage
boolean
No
Set true to remove current image
DeleteCV
boolean
No
Set true to remove current CV
Response (data):
boolean: true if updated successfully.
Error Codes
While isSuccess: false is the primary check, erroCode provides specific details:
0: No Error
1: Validation Error (Check message for details)
2: Unauthorized
3: Forbidden
4: Not Found
5: Internal Server Error
6: Bad Request
IEEE SVU - Backend API Documentation (Dev)
This document provides the necessary details for the frontend team to integrate with the User and Authentication endpoints.
Base URL (Development)
http://localhost:5242https://localhost:7135Authentication Flow
The system uses JWT (JSON Web Token) for authentication.
/api/User/loginendpoint.datafield.Authorizationheader:Authorization: Bearer <your_token>Important
Refresh Tokens: Not implemented. When a token expires (default 1 hour), the API returns
401 Unauthorized. The user must log in again.Response Wrapper
All API responses follow a consistent wrapper format:
{ "data": T, // The actual response data (Object, String, or Boolean) "erroCode": 0, // Internal error code (0 = No Error) "message": "...", // Human-readable message "isSuccess": true // Boolean indicating success }Endpoints
1. Register User
Create a new user account.
/api/User/RegisterPOSTmultipart/form-data(Form Data)Request Body (Fields):
FullNamestringEmailstringUniversitystringPasswordstringConfirmPasswordstringPasswordFacultyOrDepartmentstringResponse (
data):boolean:trueif registered successfully.2. Login User
Authenticate and receive a JWT token.
/api/User/loginPOSTapplication/jsonRequest Body (JSON):
{ "email": "user@example.com", "password": "password123" }Response (
data):string: The JWT Access Token.3. Get User Profile (Protected)
Retrieve the current authenticated user's profile information.
/api/User/ProfileGETBearer TokenRequiredResponse (
data):{ "fullName": "John Doe", "imageUrl": "http://...", "email": "john@example.com", "phoneNumber": "0123456789", "university": "SVU", "faculty": "Engineering", "cv": "http://..." }4. Edit Profile (Protected)
Update profile details, including file uploads.
/api/User/editprofilePUTBearer TokenRequiredmultipart/form-data(Form Data)Request Body (Fields):
FullNamestringUniversitystringFacultystringPhoneNumberstringImageFileCVFileDeleteImagebooleantrueto remove current imageDeleteCVbooleantrueto remove current CVResponse (
data):boolean:trueif updated successfully.Error Codes
While
isSuccess: falseis the primary check,erroCodeprovides specific details:0: No Error1: Validation Error (Checkmessagefor details)2: Unauthorized3: Forbidden4: Not Found5: Internal Server Error6: Bad Request