Re: Dumb ERRest questions
Re: Dumb ERRest questions
- Subject: Re: Dumb ERRest questions
- From: Andrew Kinnie <email@hidden>
- Date: Mon, 21 Mar 2011 10:47:35 -0400
Yeah I saw that documentation page, and the presentation. I could just swear I saw previously an overview of how this works, what it does, and why it does what it does what it does. I need a 30,000 ft (10,000 meter?) view. In the mean time, passing the parameters seems straightforward enough with your explanation I'll work on it from that perspective.
Not sure if I can make WOWODC this year, unfortunately. Maybe, assuming I don't go to WWDC.
Thanks. This gives me a better start.
Andrew
On Mar 21, 2011, at 10:31 AM, Pascal Robert wrote:
>
> Le 2011-03-21 à 10:16, Andrew Kinnie a écrit :
>
>> I am attempting to use ERRest as an interface for a push notification server for our iOS apps, and am having some difficulties, partly related to never having used Rails or Rest to begin with. I am looking to have the server receive json files for the notifications from the web side of our company, and then process them, sending appropriate notifications back to the Apple APN server for each device. Also it needs to be able to receive json requests from the devices themselves when they install the app and turn on notifications. So it seemed to me that ERRest would be a good option for a WO app which takes JSON and (through Javapns google code project) sends Apple what Apple needs to send the notifications.
>>
>> I watched Mike's screencast for a WO-NoVA from last year, and I think I understand some of the basics. Is there an ERRest tutorial some place?
>
> http://wiki.objectstyle.org/confluence/display/WONDER/ERRest+Framework
>
> The presentation from Mike at WOWODC West 2009 and mine from WOWODC 2010 should have a lot of the stuff you need. And WOWODC 2011 will have a couple of presentations with ERRest stuff in it :-)
>
> And have a look at the ERRestRouteExample and Movies examples from Project Wonder.
>
>> I seem to remember there was a good overview in the Wonder docs someplace, but do not seem to be able to find it now.
>>
>> Basically, I created a couple subclasses of ERXDefaultRouteController for each of a couple entities, and have added a bunch of rest related stuff into the Application constructor. I'm not, however, very clear on what I need to do to have these requests to the server provide me with data as parameters to the requests. I gather that if I have a Register action in my device controller, the devices could call a url like http://myurl/ra/Device/Register but I am just fundamentally missing something about how parameters would work.
>
> When you send data to the REST service, you don't post parameters, you post data in the body of the request. That data can be JSON or any other format that ERRest support. So for example, with CURL, you do something like this to create a new Device object:
>
> curl -X POST -d "{ 'type': 'Device', 'attribute1': 'value1', 'attribute2': 'value2' }" http://myurl/ra/Device
>
> Don't forget that REST use HTTP verbs, so a GET is to fetch data, POST to create new data (new instances of entities), PUT is to update data and DELETE. You shouldn't need to use arguments in the URLs for POST/DELETE/PUT operations, unless you need to pass a API key or something like that.
>
> And in your route controller, you use routeObjectForKey(), that method will find the data send by clients and convert to an EO.
>
>> I gather there is an @PathParam("myparametername") MyParemeterClass myLocalInstanceOfThatClass) but I'm not sure if this is the way this should do it, or if there are alternatives. I'm also not exactly sure how this works.
>>
>> So I guess my fundamental question is where can I find anything close to a tutorial or overview of ERRest? (I have looked at the ERRestRouteExample example app)
>>
>> Thanks in advance
>>
>> Andrew
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden