Basic Blueprint for a sqlalchemy model
Subclass of tornado.web.RequestHandler that handles web requests.
Overwrite get() / post() / put() / patch() / delete() if you want complete customize handling of the methods. Note that the default implementation of this function check for the allowness and then call depending on the instance_id parameter the associated _single / _many method, so you probably want to call super()
If you just want to customize the handling of the methods overwrite method_single or method_many.
If you want completly disable a method overwrite the SUPPORTED_METHODS constant
Init of the handler, derives arguments from api create_api_blueprint
| Parameters: |
|
|---|---|
| Reqheader X-HTTP-Method-Override: | |
If allow_method_override is True, this header overwrites the request method |
|
GET request
| Parameters: | instance_id (comma seperated string list) – query argument of request |
|---|---|
| Statuscode 405: | GET disallowed |
Get one instance
| Parameters: | instance_id (list of primary keys) – query argument of request |
|---|
Get all instances
Note that it is possible to provide offset and page as argument then it will return instances of the nth page and skip offset items
| Statuscode 400: | if results_per_page > max_results_per_page or offset < 0 |
|---|---|
| Query results_per_page: | |
| Overwrite the returned results_per_page | |
| Query offset: | Skip offset instances |
| Query page: | Return nth page |
| Query limit: | limit the count of modified instances |
| Query single: | If true sqlalchemy will raise an error if zero or more than one instances would be deleted |
POST (new input) request
| Parameters: | instance_id – (ignored) |
|---|---|
| Statuscode 204: | instance successfull created |
| Statuscode 404: | Error |
| Statuscode 405: | POST disallowed |
PATCH (update instance) request
| Parameters: | instance_id (comma seperated string list) – query argument of request |
|---|---|
| Statuscode 403: | PATCH MANY disallowed |
| Statuscode 405: | PATCH disallowed |
Patch one instance
| Parameters: | instance_id (list of primary keys) – query argument of request |
|---|---|
| Statuscode 201: | instance successfull modified |
| Statuscode 404: | Error |
Patch many instances
| Statuscode 201: | instances successfull modified |
|---|---|
| Query limit: | limit the count of modified instances |
| Query single: | If true sqlalchemy will raise an error if zero or more than one instances would be modified |
PUT (update instance) request
| Parameters: | instance_id (comma seperated string list) – query argument of request |
|---|---|
| Statuscode 403: | PUT MANY disallowed |
| Statuscode 404: | Error |
| Statuscode 405: | PUT disallowed |
DELETE (delete instance) request
| Parameters: | instance_id (comma seperated string list) – query argument of request |
|---|---|
| Statuscode 403: | DELETE MANY disallowed |
| Statuscode 405: | DELETE disallowed |
Get one instance
| Parameters: | instance_id (list of primary keys) – query argument of request |
|---|---|
| Statuscode 204: | instance successfull removed |