PHPackages                             robbyahn/restfulserver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. robbyahn/restfulserver

ActiveSilverstripe-module[HTTP &amp; Networking](/categories/http)

robbyahn/restfulserver
======================

Add a RESTful API to your SilverStripe application

2.1.0(7y ago)0252BSD-3-ClausePHP

Since Jul 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/robbyahn/silverstripe-restfulserver)[ Packagist](https://packagist.org/packages/robbyahn/restfulserver)[ RSS](/packages/robbyahn-restfulserver/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (4)Versions (23)Used By (0)

SilverStripe RestfulServer Module
=================================

[](#silverstripe-restfulserver-module)

[![Build Status](https://camo.githubusercontent.com/e32899e5da297af5b4c5fd175e7ae607a22e3e9c65755bd91cb3a8293147e484/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f73696c7665727374726970652f73696c7665727374726970652d7265737466756c7365727665722e706e67)](http://travis-ci.org/silverstripe/silverstripe-restfulserver)

Overview
--------

[](#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
------------

[](#requirements)

- SilverStripe 3.0 or newer

Configuration
-------------

[](#configuration)

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

Example DataObject with simple api access, giving full access to all object properties and relations, unless explicitly controlled through model permissions.

```
class Article extends DataObject {
	static $db = array('Title'=>'Text','Published'=>'Boolean');
	static $api_access = true;
}

```

Example DataObject with advanced api access, limiting viewing and editing to Title attribute only:

```
class Article extends DataObject {
	static $db = array('Title'=>'Text','Published'=>'Boolean');
	static $api_access = array(
		'view' => array('Title'),
		'edit' => array('Title'),
	);
}

```

Supported operations
--------------------

[](#supported-operations)

- `GET /api/v1/(ClassName)/(ID)` - gets a database record
- `GET /api/v1/(ClassName)/(ID)/(Relation)` - get all of the records linked to this database record by the given reatlion
- `GET /api/v1/(ClassName)?(Field)=(Val)&(Field)=(Val)` - searches for matching database records
- `POST /api/v1/(ClassName)` - create a new database record
- `PUT /api/v1/(ClassName)/(ID)` - updates a database record
- `PUT /api/v1/(ClassName)/(ID)/(Relation)` - updates a relation, replacing the existing record(s) (NOT IMPLEMENTED YET)
- `POST /api/v1/(ClassName)/(ID)/(Relation)` - updates a relation, appending to the existing record(s) (NOT IMPLEMENTED YET)
- DELETE /api/v1/(ClassName)/(ID) - deletes a database record (NOT IMPLEMENTED YET)
- DELETE /api/v1/(ClassName)/(ID)/(Relation)/(ForeignID) - remove the relationship between two database records, but don't actually delete the foreign object (NOT IMPLEMENTED YET)
- POST /api/v1/(ClassName)/(ID)/(MethodName) - executes a method on the given object (e.g, publish)

Search
------

[](#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.

Other url-modifiers
-------------------

[](#other-url-modifiers)

- `&limit=`: Limit the result set
- `&relationdepth=`: Displays links to existing has-one and has-many relationships to a certain depth (Default: 1)
- `&fields=`: Comma-separated list of fields on the output object (defaults to all database-columns). Handy to limit output for bandwidth and performance reasons.
- `&sort=&dir=`
- `&add_fields=`: Comma-separated list of additional fields, for example dynamic getters.

Access control
--------------

[](#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.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~103 days

Recently: every ~32 days

Total

19

Last Release

2828d ago

Major Versions

1.0.x-dev → 2.0.0-beta12017-12-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/3951404c139115165e65a3d2b6bd80d84b60849a46b9049f0f1f26f71d45e7bf?d=identicon)[RobbyAhn](/maintainers/RobbyAhn)

---

Top Contributors

[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (14 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (7 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (5 commits)")[![NightJar](https://avatars.githubusercontent.com/u/778003?v=4)](https://github.com/NightJar "NightJar (2 commits)")[![robbyahn](https://avatars.githubusercontent.com/u/2970208?v=4)](https://github.com/robbyahn "robbyahn (2 commits)")[![mateusz](https://avatars.githubusercontent.com/u/118653?v=4)](https://github.com/mateusz "mateusz (1 commits)")[![scott1702](https://avatars.githubusercontent.com/u/10215604?v=4)](https://github.com/scott1702 "scott1702 (1 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (1 commits)")

---

Tags

apirestsilverstripe

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/robbyahn-restfulserver/health.svg)

```
[![Health](https://phpackages.com/badges/robbyahn-restfulserver/health.svg)](https://phpackages.com/packages/robbyahn-restfulserver)
```

###  Alternatives

[silverstripe/restfulserver

Add a RESTful API to your SilverStripe application

49545.2k4](/packages/silverstripe-restfulserver)[colymba/silverstripe-restfulapi

SilverStripe RESTful API with a default JSON serializer.

6328.8k](/packages/colymba-silverstripe-restfulapi)[mediamonks/rest-api-bundle

MediaMonks Rest API Symfony Bundle

1656.2k1](/packages/mediamonks-rest-api-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
