Skip to content

xrefor/door-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

A basic API introduction

Followed tutorial by Miguel Grinberg https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

A great guide for designing a simple RESTful API with Python and Flask. This application contains all the code from the tutorial and i intend to develop the applicaiton further. Currently the API supports GET, POST, PUT and DELETE, as well as single user authentication wich can be enabled/disabled per function.

The API does not use a database but saves all changes directly in memory, needless to say this is not code that should run in production.

Example commands:

Show tasks:

curl -i http://localhost:5000/door/api/tasks

Add task:

curl -u admin:password -H "Content-Type: application/json" -X POST -d '{"title":"alarm", "description":"Turn alarm on/off"}' http://localhost:5000/door/api/tasks

Update task:

curl -u admin:password -i -H "Content-Type: application/json" -X PUT -d '{"done":true}' http://localhost:5000/door/api/tasks/3

Delete task:

curl -u admin:password -i -X DELETE http://localhost:5000/door/api/tasks/3

About

Basic API with python and flask

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages