Skip to content

darrenhankins/todo-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

todo-api

RESTful API with Python and Flask

http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

Start the API

Open up terminal window, run

$ python app.py

Running on http://127.0.0.1:5000/

Since this RESTful API requires an authorized user. Opens up another terminal window, run command below. Should result in a list of tasks.

curl -u username:password -i http://localhost:5000/todo/api/v1.0/tasks
Additional Commands

Get specific task (2)

curl -i http://localhost:5000/todo/api/v1.0/tasks/2

Get all tasks

curl -u username:password -i http://localhost:5000/todo/api/v1.0/tasks @app.route('/todo/api/v1.0/tasks', methods=['GET'])

Create new task

curl -u username:password -i -H "Content-Type: application/json" -X POST -d '{"title":"Write a letter"}' http://localhost:5000/todo/api/v1.0/tasks

Update task (2)

curl -u username:password -i -H "Content-Type: application/json" -X PUT -d '{"description":"This is a test","done":false}' http://localhost:5000/todo/api/v1.0/tasks/2

Delete a task (2)

curl -u username:password -i -X "DELETE" http://localhost:5000/todo/api/v1.0/tasks/2

About

RESTful API Example (Python, Flask)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages