| 33 | |
| 34 | === Description === |
| 35 | |
| 36 | The [http://eden.sahanafoundation.org/wiki/S3XRC/RESTfulAPI/s3_rest_controller s3_rest_controller] function is a helper function which easily apply the RESTful API over your controller. |
| 37 | Every time user request for a resource the s3_rest_controller function is called and return an output which then is passed to the view. |
| 38 | The above diagram explains how a s3_rest_controller responds to request and gives the generate the desired output. |
| 39 | |
| 40 | * So first s3_rest_controller function parse the request object to S3Request class to generate S3Request object (r) having following attributes [http://eden.sahanafoundation.org/wiki/S3XRC/RESTfulAPI/S3Request S3Request] |
| 41 | * During this process S3Resource or r.resource is also generated |
| 42 | |
| 43 | * Then different method handlers are configured using set_handler function. |
| 44 | |
| 45 | * After that S3Request is executed, During execution first thing that occur is a check for any hook to prep function, [http://eden.sahanafoundation.org/wiki/S3XRC/RESTfulAPI/s3_rest_controller#Pre-Process prep] is defined to get s3rest functionality, prep hook would allow you to change the handler configuration in certain situations. |
| 46 | |
| 47 | * Then method handler is determined , i.e the GET,POST,PUT,DELETE or other custom method |
| 48 | * Then the handler are executed to get the desired output,If the no handlers are present , then the S3CRUD method is called which fills the output with create, update , list or delete form. |
| 49 | |
| 50 | * And then a check for any hook to postprocessor occurs. |
| 51 | |
| 52 | * Then some action buttons are added and the output is send to the view. |
| 53 | |
| 54 | In case of interactive views output would be a dictionary with components that are then passed to the view, |
| 55 | this could also contain a form. |
| 56 | |
| 57 | |