Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shalinir8/calendar-task-api
https://github.com/shalinir8/calendar-task-api
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/shalinir8/calendar-task-api
- Owner: ShaliniR8
- Created: 2024-11-02T18:52:57.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-12-21T23:16:05.000Z (about 1 month ago)
- Last Synced: 2024-12-21T23:22:17.289Z (about 1 month ago)
- Language: HTML
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Task Manager Flask App
A simple Flask application that allows you to create, store, and query tasks using a SQLite database. Each task has a `datetime`, `task`, and `status` field.
## Table of Contents
- [Features](#features)
- [Endpoints](#endpoints)
- [Testing the API](#testing-the-api)
## Features- Add new tasks with a description and status.
- Retrieve all tasks or a specific task by ID.
- Update existing tasks.
- Delete tasks.
- Uses SQLite for data storage.
- API follows RESTful principles.## Endpoints
### 1. Create a New Task
- **URL**: `/tasks`
- **Method**: `POST`
- **Request Body** (JSON):
```
{
"task": "Task description here",
"status": "Task status here"
}
```
- **Response** (201 Created):
```
{
"message": "Task added successfully"
}
```### 2. Retrieve All Tasks
- **URL**: `/tasks`
- **Method**: `GET`
- **Response** (200 OK):
```
[
{
"id": 1,
"datetime": "2023-10-05T12:34:56.789123",
"task": "Task description here",
"status": "Task status here"
},
...
]
```### 3. Retrieve a Task by ID
- **URL**: `/tasks/`
- **Method**: `GET`
- **Response** (200 OK):
```
{
"id": 1,
"datetime": "2023-10-05T12:34:56.789123",
"task": "Task description here",
"status": "Task status here"
}
```### 4. Update a Task
- **URL**: `/tasks/`
- **Method**: `PUT`
- **Request Body** (JSON):
```
{
"task": "Updated task description",
"status": "Updated task status"
}
```
- **Response** (200 OK):
```
{
"message": "Task updated successfully"
}
```### 5. Delete a Task
- **URL**: `/tasks/`
- **Method**: `DELETE`
- **Response** (200 OK):
```
{
"message": "Task deleted successfully"
}
```## Testing the API
### **1. Add a New Task**
```bash
curl -X POST -H "Content-Type: application/json" -d '{"task": "Finish report", "status": "In Progress"}' http://localhost:5000/tasks
```### **2. Get All Tasks**
```bash
curl http://localhost:5000/tasks
```### **3. Get a Task by ID**
```bash
curl http://localhost:5000/tasks/1
```### **4. Update a Task**
```bash
curl -X PUT -H "Content-Type: application/json" -d '{"status": "Completed"}' http://localhost:5000/tasks/1
```
### **5. Delete a Task**
```bash
curl -X DELETE http://localhost:5000/tasks/1
```