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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Restful Server in Silverstrip 3


Go to End


4 Posts   1498 Views

Avatar
SS_Learner

Community Member, 20 Posts

29 July 2012 at 1:30am

Hello Friends,

I am using Silverstripe 3 and fount Restful server class is missing in SS3,So i installed the Restful server module for SS3,

In my DataObject class i have enabled the Resetful service like
static $api_access = array(
'view' => array('data'),
);

But when i try to use the link domain.com/api/v1/tablename/?xyz=123 ,it returns
<DataList totalSize="5">
</DataList> ,bu not the recoreds which i want i.e data form the tablename.
Any help appriciated....
Thank You

Avatar
Willr

Forum Moderator, 5523 Posts

29 July 2012 at 8:14pm

Make sure you have defined a canView() function on your DataObject and that it returns true (or does whatever permission checking you need)

Avatar
SS_Learner

Community Member, 20 Posts

31 July 2012 at 2:46pm

Thanks Willr it worked,
But one thng is if i am using date in the url like
domain.com/api/v1/tablename/?xyz=2012-01-12

I am getting all the records from database instead of only one corresponding to that date.
I have only one record for xyz=2012-01-12,but i get all.
What can be the reason for this?

Avatar
Stef87

Community Member, 66 Posts

3 August 2012 at 2:43am

I know this is a little away from what you were discussing but I am having trouble with the RESTful Server API in 2.4.7 but it asks me to log in when I put this in http://localhost:8888/2.4.7/api/v1/ArticlePage/1

It then says my name and password are wrong. I've checked and rechecked and it is definitely right because it is the one I gave when installing SilverStripe. I know it must be something obvious but I'm stuck.

Thanks in advance.