Readme

SilverStripe RestfulServer Module

Overview

This class gives your application a RESTful API. All you have to do is define static $api_access = true on
the appropriate DataObjects. You will need to ensure that all of your data manipulation and security is defined in
your model layer (ie, the DataObject classes) and not in your Controllers. This is the recommended design for SilverStripe
applications.

Requirements

SilverStripe 3.0 or newer

Configuration

Enabling restful access on a model will also enable a SOAP API, see SOAPModelAccess.

POST /api/v1/(ClassName)/(ID)/(MethodName) - executes a method on the given object (e.g, publish)

Search

You can trigger searches based on the fields specified on DataObject::searchable_fields and passed
through DataObject::getDefaultSearchContext(). Just add a key-value pair with the search-term
to the url, e.g. /api/v1/(ClassName)/?Title=mytitle.

Access control

Access control is implemented through the usual Member system with Basicauth authentication only.
By default, you have to bear the ADMIN permission to retrieve or send any data.
You should override the following built-in methods to customize permission control on a
class- and object-level:

DataObject::canView()

DataObject::canEdit()

DataObject::canDelete()

DataObject::canCreate()

See DataObject documentation for further details.

You can specify the character-encoding for any input on the HTTP Content-Type.
At the moment, only UTF-8 is supported. All output is made in UTF-8 regardless of Accept headers.