Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » post external json into Dataobject

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: 590 Views
  • moloko_man
    Avatar
    Community Member
    72 Posts

    post external json into Dataobject Link to this post

    Is it possible to post external json data into either a DataObject or DataobjectSet in Silverstripe?

    Basically I'm developing a small site that will be fed data from a mobile application. The iPhone/android app will push public data to the site. After the data is pushed I will be able to generate reports/graphs and have users search and compare themselves against other users.

    I have looked into the RestfulService, and SOAPModelAccess and have been researching and searching the forums all day yesterday, but there is nothing that talks about being able to accept external post requests to an API on my server. Is this even possible?

    Thanks

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: post external json into Dataobject Link to this post

    RestFul Service is the class for consuming remote API's (like twitter) RestfulServer is the class you want to look at for providing an API - http://API.silverstripe.org/2.4/sapphire/api/RestfulServer.html

  • moloko_man
    Avatar
    Community Member
    72 Posts

    Re: post external json into Dataobject Link to this post

    @Willr, that does make more sense, thanks. I totally overlooked RestfulServer

    I built a quick (and dirty?) test and its very simple. It's essentially a form posting, so in my controller I just set up an allowed actions for my method that will act as the form processor, set SecurityToken::disable(); so I don't get a CSFR attack notice, then just return what I need to do. (I'm doing this quick method to show proof of concept.)

    I will use RestfulServer, though, to build out what I need so its more secure in the end.

    Thanks again for your help.

  • moloko_man
    Avatar
    Community Member
    72 Posts

    Re: post external json into Dataobject Link to this post

    Does RestfulServer::authenticate() require that a user be present in the database? Or can I provide an API key for a device to connect to, to authenticate?

    590 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.