API Specification
1. Split Expense Among Group Members
This endpoint allows splitting an expense among group members, either evenly or based on specified criteria.
Endpoint: POST /groups/{group_id}/split-expense
Request
-
Path Parameter:
group_id (int): The ID of the group.
-
Body:
{
"trip_id": int,
"description": string,
"total_amount": float,
"split_details": [
{
"user_id": int,
"share_percentage": float
}
]
}
Response
2. Group Balance Overview
This endpoint provides a summary of the group's financial status, showing each member's net balance, considering all transactions and expenses.
Endpoint: GET /groups/{group_id}/balance-overview
Request
- Path Parameter:
group_id (int): The ID of the group.
Response
API Specification
1. Split Expense Among Group Members
This endpoint allows splitting an expense among group members, either evenly or based on specified criteria.
Endpoint:
POST /groups/{group_id}/split-expenseRequest
Path Parameter:
group_id(int): The ID of the group.Body:
{ "trip_id": int, "description": string, "total_amount": float, "split_details": [ { "user_id": int, "share_percentage": float } ] }Response
Success (200 OK):
{ "message": "Expense split successfully", "split_summary": [ { "user_id": int, "owed_amount": float } ] }Failure (e.g., 400 Bad Request):
{ "error": "Invalid request data" }2. Group Balance Overview
This endpoint provides a summary of the group's financial status, showing each member's net balance, considering all transactions and expenses.
Endpoint:
GET /groups/{group_id}/balance-overviewRequest
group_id(int): The ID of the group.Response
Success (200 OK):
{ "group_balance": [ { "user_id": int, "net_balance": float } ], "transaction_details": [ { "transaction_id": int, "from_user_id": int, "to_user_id": int, "amount": float, "description": string, "date": string } ] }Failure (e.g., 404 Not Found):
{ "error": "Group not found" }