Re: getting to know Mr. ERXRoute
Re: getting to know Mr. ERXRoute
- Subject: Re: getting to know Mr. ERXRoute
- From: Jesse Tayler <email@hidden>
- Date: Fri, 31 Dec 2010 12:41:32 -0500
Thanks all -
Right now, I am able to create a new post from a specific author, as long as I have that author's ID but to do that, I have to comment out the line which sets that relationship for the web.
The trouble is, as Mark suggests, the core biz logic causes troubles for me because there's no session user.
now -- this is where I'd love some advice.
if I'm making a Twitter style app, is it best to setup "authenticate-first" -a session user for webservice? or perhaps it is best to supply a user/pass with each request somehow?
thanks for any pointers...
On Dec 31, 2010, at 8:17 AM, Pascal Robert wrote:
>
> Le 2010-12-30 à 14:48, Jesse Tayler a écrit :
>
>> My understanding of ERRestRouteExample seems ok.
>>
>> I can create a new Pet and tie it to a person in ERRestRouteExample:
>>
>>
>> curl -X POST -d "{ name:'Rover', owner: { type:'Person', id:1 } }" http://Jesse-Taylers-iMac.local:5999/cgi-bin/WebObjects/RESTExample.woa/ra/Pet.json
>>
>>
>> I can create a new Person in my own model, but when I try to create a new Post and tie it to that user, I have either one of two possible troubles:
>>
>>
>> curl -X POST -d "{ title:'A Title', author: { type:'User', id:1 } }" http://Jesse-Taylers-iMac.local:5999/cgi-bin/WebObjects/WOMan.woa/ra/Mtly.json
>>
>>
>> It either produces an error from the EO init while trying to set the author:
>>
>>
>> setAuthorRelationship((User) ((User)ERCoreBusinessLogic.actor()).localInstanceIn(editingContext()))
>
> You shouldn't need to set the relationship in your route method, does your "Post" EO have a relation named "Author" which links to a User?
>
>>
>> Or if I don't use that method, I get an error from validation?
>>
>> A <b>Mtly</b> must have a <b>Author</b>.
>>
>>
>> Surely, I am mixing things?
>>
>>
>
>
_______________________________________________
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