Skip to content
REST api module for Silverstripe
PHP Scheme
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
code added php7.2 compatibility Dec 19, 2018
docs Add keys May 20, 2016
templates/Layout add template for html rendering Sep 3, 2015
.travis.yml Add some tests May 18, 2016
_config.php added php7.2 compatibility Dec 19, 2018
composer.json Add keys May 20, 2016

REST module for Silverstripe

Build Status Latest Stable Version License Scrutinizer Code Quality Total Downloads

This module models the REST api in a simple fashion.

All routes for the different resources should resolved by a controller which extends the BaseRestController.

After that, you can add your routes into your YAML config file.


  • Queries
  • Field list
  • Different serialisation formats
  • Pagination
  • Presenters


For the definition of your routes, use the Silverstripe config system. You can add nested routes before the base route of that endpoint. In this example we have v/1/sessions, v/1/users/<ID> and v/1/users/<ID>/friends.

    'v/1/users/$ID!/friends/$FriendID': 'FriendshipController'
    'v/1/users/$ID': 'UserController'
    'v/1/sessions/$ID': 'Ntb\RestAPI\SessionController'

GET Parameters

If you visit your api through a browser, the controller will render it as html as long as you not specify an accept GET param, eg. ?accept=json.

You can specify the access token with access_token. This can be used for accessing restricted resources with specific privileges.


For functional tests, you can extend the RestTest class and use it to test your application. We recommend to use fixtures for testing like it is explained in the Silverstripe documentation.

More Information

You can find more information in the wiki.

You can’t perform that action at this time.