Difference between revisions of "Python - Flask"
(Created page with " = Rest APIs Development with Flask-RESTful= Flask extension that simplifies the creation of APIs. ==The RESTful server== Here is the definition of the ToDo List web service...") |
(→The RESTful server) |
||
Line 9: | Line 9: | ||
<source> | <source> | ||
HTTP Method URI Action | HTTP Method URI Action | ||
− | GET http://[hostname]/todo/api/v1.0/tasks | + | GET http://[hostname]/todo/api/v1.0/tasks Retrieve list of tasks |
GET http://[hostname]/todo/api/v1.0/tasks/[task_id] Retrieve a task | GET http://[hostname]/todo/api/v1.0/tasks/[task_id] Retrieve a task | ||
− | POST http://[hostname]/todo/api/v1.0/tasks | + | POST http://[hostname]/todo/api/v1.0/tasks Create a new task |
PUT http://[hostname]/todo/api/v1.0/tasks/[task_id] Update an existing task | PUT http://[hostname]/todo/api/v1.0/tasks/[task_id] Update an existing task | ||
DELETE http://[hostname]/todo/api/v1.0/tasks/[task_id] Delete a task | DELETE http://[hostname]/todo/api/v1.0/tasks/[task_id] Delete a task |
Revision as of 07:03, 22 September 2020
Rest APIs Development with Flask-RESTful
Flask extension that simplifies the creation of APIs.
The RESTful server
Here is the definition of the ToDo List web service that has been serving as an example:
HTTP Method URI Action
GET http://[hostname]/todo/api/v1.0/tasks Retrieve list of tasks
GET http://[hostname]/todo/api/v1.0/tasks/[task_id] Retrieve a task
POST http://[hostname]/todo/api/v1.0/tasks Create a new task
PUT http://[hostname]/todo/api/v1.0/tasks/[task_id] Update an existing task
DELETE http://[hostname]/todo/api/v1.0/tasks/[task_id] Delete a task
The only resource exposed by this service is a "task", which has the following data fields:
- uri: unique URI for the task. String type.
- title: short task description. String type.
- description: long task description. Text type.
- done: task completion state. Boolean type.