https://github.com/mhmzdev/flask-restful-crud-api
A very simple API of TODO app for handling CRUD operation (TESTING ONLY)
https://github.com/mhmzdev/flask-restful-crud-api
Last synced: 2 months ago
JSON representation
A very simple API of TODO app for handling CRUD operation (TESTING ONLY)
- Host: GitHub
- URL: https://github.com/mhmzdev/flask-restful-crud-api
- Owner: mhmzdev
- Created: 2022-10-23T07:16:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-23T09:56:56.000Z (over 3 years ago)
- Last Synced: 2025-03-22T02:03:11.062Z (about 1 year ago)
- Language: Python
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## flask-restful CRUD API
A very simple example of TODO App CRUD operations via REST API in flask-restful that could be used for testing purposes.
### Running locally
```
git clone https://github.com/mhmzdev/flask-restful-CRUD
cd flask-restful_CRUD
pip install -r requirements.txt
python app.py
```
Open http://localhost:8080/tasks at your browser to see if you are getting all tasks
### Deployed
It's deployed on Heroku at https://flask-restful-tasks.herokuapp.com/tasks
### Available methods
Below is the end-point that remains the same for all the methods to keep things simple.
Local Endpoint: http://localhost:8080/tasks
Deployed Endpoint: https://flask-restful-tasks.herokuapp.com/tasks
### ⬇️ GET
Simply make a REQUST at the end-point given
Response:
```
{
"status": "success",
"tasks": [
{
"id": 0,
"title": "Home related",
"description": "Some description here.",
"isCompleted": false
},
{
"id": 1,
"title": "Python Coding task",
"description": "Develop a REST API",
"isCompleted": false
},
{
"id": 2,
"title": "Others",
"description": "Make some notes from the Podcast",
"isCompleted": false
}
]
}
```
To get a specific task, send payload as following to GET method
```
{
"id": 0
}
```
Response:
```
{
"status": "success",
"task": {
"id": 0,
"title": "Home related",
"description": "Some description here.",
"isCompleted": false
}
}
```
### ⬆️ POST
Request payload:
```
{
"title": "Some title",
"description": "Some description"
}
```
Response:
```
{
'status': 'success',
'message': 'Task has been added successfully!',
}
```
### 🔄 PUT
Request payload:
```
{
"id": 0,
"title": "Some new title",
"description": "Some new description",
"isCompleted: true,
}
```
Response:
```
{
'status': 'success',
'message': 'Task has been updated successfully!',
}
```
### ❌ DELETE
Request payload:
```
{
"id": 0
}
```
Response:
```
{
'status': 'success',
'message': 'Task has been deleted successfully!',
}
```