21300 Posts in 5735 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 406 Views |
-
post external json into Dataobject

1 June 2012 at 6:08am
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
-
Re: post external json into Dataobject

2 June 2012 at 12:27pm
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
-
Re: post external json into Dataobject

2 June 2012 at 8:13pm
@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.
-
Re: post external json into Dataobject

20 June 2012 at 10:38am
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?
| 406 Views | ||
|
Page:
1
|
Go to Top |


