Jump to:

22999 Posts in 11854 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » RESTfulServer (SilverStripe book)

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

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

Page: 1
Go to End
Author Topic: 1651 Views
  • dendeffe
    Avatar
    Community Member
    135 Posts

    RESTfulServer (SilverStripe book) Link to this post

    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?

  • mark_s
    Avatar
    Community Member
    78 Posts

    Re: RESTfulServer (SilverStripe book) Link to this post

    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

  • MonkeyBen
    Avatar
    Community Member
    25 Posts

    Re: RESTfulServer (SilverStripe book) Link to this post

    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.

    1651 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.