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.

All other Modules

Discuss all other Modules here.

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

Restful Server in Silverstrip 3


Reply

4 Posts   909 Views

Avatar
SS_Learner

29 July 2012 at 1:30am Community Member, 18 Posts

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

29 July 2012 at 8:14pm Forum Moderator, 5511 Posts

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

31 July 2012 at 2:46pm Community Member, 18 Posts

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

3 August 2012 at 2:43am Community Member, 66 Posts

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.