End Points - bounswe/bounswe2025group10 GitHub Wiki
API Endpoints Documentation
Base URL: http://134.209.253.215:8000/
Authentication Endpoints
1. Sign Up
- URL:
/signup/
- Method:
POST
- Description: Register a new user
- Request Body:
{
"email": "[email protected]",
"username": "test",
"password": "123456789"
}
- Success Response (201 Created):
{
"message": "User created successfully.",
"data": {
"email": "[email protected]",
"username": "test"
}
}
- Error Response (400 Bad Request):
{
"username": ["Email already exists."]
}
- Error Response (400 Bad Request):
{
"email": ["Username already exists"]
}
2. Login
- URL:
/login/
- Method:
POST
- Description: Authenticate user and get tokens
- Request Body:
{
"email": "[email protected]",
"password": "123456789"
}
- Success Response (200 OK):
{
"message": "Login successful.",
"token": {
"access": "your_access_token_here",
"refresh": "your_refresh_token_here"
}
}
- Error Response (401 Unauthorized):
{
"error": "Invalid credentials!"
}
3. Server Status
- URL:
/status/
- Method:
GET
- Description: Check if server is running
- No Request Body Required
- Success Response (200 OK):
{
"status": "Server is running"
}
4. User Info (Protected)
- URL:
/me/
- Method:
GET
- Description: Get authenticated user information
- Headers Required:
Authorization: Bearer <access_token>
- Success Response (200 OK):
{
"username": "testuser",
"is_authenticated": true
}
- Error Response (401 Unauthorized):
{
"detail": "Authentication credentials were not provided."
}
Notes
- All tokens are JWT tokens with a 100-year lifespan
- User info end point is temporary, it is created only to check whether jwt tokens work.
- Only
/signup/
,/login/
, and/status/
endpoints are publicly accessible