The spreadsheet should have 2 main sheets. First sheet is for meal calculation and another is for cost of bazar done by an individual
This API allows you to perform various CRUD operations and retrieve data from Google Sheets. The operations include listing data, adding rows, updating rows, and calculating totals, all organized by user and sheet name.
- URL:
/
- Method:
GET
- Description: Retrieve data from the main sheet.
- Example:
curl -X GET http://localhost:8000/
- URL:
/given/
- Method:
GET
- Description: Retrieve data from a specified sheet.
- Example:
curl -X GET http://localhost:8000/given/
- URL:
/add/<str:user>/<str:sheet>/
- Method:
POST
- Description: Add a new row for a user to a specific sheet.
- Parameters:
user
: The name of the user.sheet
: The sheet where the row will be added.
- Example:
curl -X POST http://localhost:8000/add/john/Sheet1/ -H "Content-Type: application/json" -d '{"values": [1, 2, 3]}'
- URL:
/add/<str:user>/<int:day>/<str:sheet>/
- Method:
POST
- Description: Add a new row for a user on a specified day in a specific sheet.
- Parameters:
user
: The name of the user.day
: The day to add the row for.sheet
: The sheet where the row will be added.
- Example:
curl -X POST http://localhost:8000/add/john/4/Sheet1/ -H "Content-Type: application/json" -d '{"values": [1, 2, 3]}'
- URL:
/update/<int:day>/<str:user>/<str:sheet>/
- Method:
PUT
- Description: Update a row for a specific user on a specific day in a given sheet.
- Parameters:
day
: The day to update.user
: The name of the user.sheet
: The sheet where the row is located.
- Example:
curl -X PUT http://localhost:8000/update/4/john/Sheet1/ -H "Content-Type: application/json" -d '{"values": [5, 6, 7]}'
- URL:
/delete/<int:day>/<str:sheet>/
- Method:
DELETE
- Description: Delete a row for a specific day in a given sheet.
- Parameters:
day
: The day to delete.sheet
: The sheet where the row will be deleted.
- Example:
curl -X DELETE http://localhost:8000/delete/4/Sheet1/
- URL:
/total-meal/<str:user>/
- Method:
GET
- Description: Get the total meal count for a specific user. Or you can get the total meal and total cost of all user
- Parameters:
user
: The name of the user.
- Example:
curl -X GET http://localhost:8000/total/<str:user>/
- Parameters:
- No user needed
- Example:
curl -X GET http://localhost:8000/total/
- URL:
/users/
- Method:
GET
- Description: Get a list of all users.
- Example:
curl -X GET http://localhost:8000/users/
- URL:
/get/<str:user>/<str:sheet>/
- Method:
GET
- Description: Get meal data for a specific user from a specific sheet.
- Parameters:
user
: The name of the user.sheet
: The sheet to retrieve the meal data from.
- Example:
curl -X GET http://localhost:8000/get/john/Sheet1/
- Clone the repository:
git clone https://github.com/yourusername/home-api.git