Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

RESTfulServer (SilverStripe book)


Go to End


3 Posts   2104 Views

Avatar
dendeffe

Community Member, 135 Posts

15 January 2010 at 4:53am

I'm trying to use RESTfulServer as described in the Silverstripe book (from page 221 onwards).

Even when using the code example

	static $api_access = array(
		'view' => array(
			'FirstName',
			'Surname',
			'Region',
			'Introduction',
			'References',
		),
		'edit' => array(
			'FirstName',
			'Surname',
			'Region',
			'Introduction',
		)
	);

I only get this message:

You don't have access to this item through the API.

I also tried using the code and URLs described here: http://doc.silverstripe.org/doku.php?id=restfulserver

I don't really know how to get this working. Any tips on debugging this?

Avatar
mark_s

Community Member, 78 Posts

28 May 2010 at 5:39pm

Hi.

RestfulServer gives that error when one of these conditions is not met (on a GET anyway):
- the DataObject class must have the static $api_access set to true.
- the DataObject instance must return true for canView()

Mark

Avatar
monkeyben

Community Member, 25 Posts

24 January 2011 at 10:39am

Another requirement of being able to GET results using field filters is that the fields that you are searching by must be set as searchable using the object's searchable_fields array.