Customisation in Greentree
PlugIn Methods
There are a number of PlugIn events available to allow you to customise the Request/Response pipeline, and to implement your own custom resources for custom behaviour or implementation of custom data classes.
|
Method |
Purpose/details |
|---|---|
|
PlugInObjectLinkManager::eventApiCustomiseRequest |
Use this to intercept an incoming GET or POST request and perform custom behaviour. |
|
PlugInObjectLinkManager::eventApiCustomiseResponse |
Use this to intercept the response from a GET or POST request and perform custom behaviour. |
|
PlugInObjectLinkManager::eventApiHandleAuthentication |
Use this to intercept requests and perform custom authentication. Use this to perform your own authentication scheme. |
|
PlugInObjectLinkManager::eventApiGetResourceClass |
Use this to provide your own resource to accept and process HTTP requests as required. Must return a class that implements ApiHttpResourceIF |
|
PlugInObjectLinkManager::gtApiExtendIncomingObject |
Called after POST processing has been performed, allowing you to perform custom update/insert processing after standard implementation has been performed |
|
PlugInObjectLinkManager::gtApiExtendOutgoingObject |
Called just prior to returning the HTTP response, allows you to add data to the HTTP response |
|
PlugInObjectLinkManager::gtApiResolveIncomingObject |
Called before POST processing to allow you to perform custom validation on the incoming data |
Interfaces
The API makes use of Greentree Interfaces which are exposed in a Package called ApiHttpInterfacePackage
|
Interface |
Purpose |
|---|---|
|
ApiHttpResourceIF |
Implement this interface on a class that is returned from the plugin event eventApiGetResourceClass |
|
ApiHttpRequestMessageIF |
This is the type of message that is prepared and passed in to your ApiHttpResourceIF to wrap a HTTP Request |
|
ApiHttpResponseMessageIF |
This is the return type used to respond to a HTTP Request on your ApiHttpResourceIF implementation. |
|
ApiHttpConfigurationIF |
Gives you acess to the API configuration |
Jade Dynamic Objects
The implementation of the API uses JadeDynamicObject and JadeDynamicObjectArray type objects to pass around the data. By the time you see the data in the Greentree pipeline, the format (JSON or XML) has been deserialised into properties of a JadeDynamicObject. You then deal with the JadeDynamicObject to read values that have been POSTed, and you add properties to a JadeDynamicObject to be serialised to JSON or XML and returned to the client