...
Exposing Plugin functionality via the REST API is not currently officially supported (CO-521), however as of Registry v3.2.0 it is possible to for plugins to expose a REST API. This feature is considered experimental, as future releases may impose structure to standardize or simplify the process.
...
Note that plugin API paths will be prefixed with the plugin name, as with web pages. ie: /registry/some_plugin/controller/action/id
.
Filtering Index Views
Most REST API "View" calls can be filtered somehow, such as view all items by CO or CO Person. Plugins may wish to filter by a Plugin-specific data element. As of Registry v3.3.0, this is possible by declaring $permittedApiFilters
in the appropriate Model file. Note this is the Model associated with the desired REST API (eg: Model/MyOtherModel.php
), which is not necessarily the primary Plugin Model (Model/MyPlugin.php
).
The content of $permittedApiFilters
is an array, where each key corresponds to a column (which must be a foreign key) in the Model and the value is the related Model that will implement the desired filtering. By way of example, consider a plugin that implements two models: Boxes and Labels, where Box hasMany Label. To enable the REST API to retrieve all Labels associated with a given Box, add the following to Model/Label.php
:
Code Block | ||||
---|---|---|---|---|
| ||||
public $permittedApiFilters = array(
'box_id' => 'MyPlugin.Box'
); |
This will enable the REST call GET /registry/my_plugin/labels.json?box_id=X
.
Additional Requirements By Plugin Type
...