Changes between Version 30 and Version 31 of DeveloperGuidelinesS3Framework


Ignore:
Timestamp:
02/03/10 12:23:35 (15 years ago)
Author:
Fran Boon
Comment:

Plugin REST functions

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelinesS3Framework

    v30 v31  
    1616We extend the CRUD with a [wiki:BluePrintRESTImplementation RESTlike controller].[[BR]]
    1717This provides details on how to configure your Model & Controllers. Views may not be required, other than index.html
     18
     19==== Custom Functions Plugged into REST ====
     20In many cases it may be much easier to implement non-CRUD resource functions as REST-plugins instead of separate controllers.
     21 * see search_simple for an example
     22
     23The advantage of doing it as REST plugin is that you have a pre-parsed XRequest instead of the original request, as well as you'd preserve the actions and setting from your REST interface for this resource.
     24
     25XRequest is already checked and parsed for the REST syntax, and is resolved for the format extension (XRequest.representation) and record ID's, contains all handles to the necessary tables as well as the complete primary record (if any).
     26
     27It contains the interface to export or import the resource in XML and JSON (.import_xml() and .export_xml() resp. _json()), and of course you'd have the nice backlink helpers to quickly produce URL's:
     28{{{
     29 .here() (=URL of the current resource),
     30 .same() (=URL of the current resource, record ID replaced as "[id]"),
     31 .there() (=URL of the current resource, no function, no record ID), and
     32 .other() (=URL of the current resource, other function)
     33}}}
     34and finally, XRequest remembers the record ID until the next request to the same resource in the same session, which can be helpful when producing links (especially _next's) not knowing the record ID.
    1835
    1936=== Mandatory ===