Re: REST PUT request creating related objects rather than just updating them
Re: REST PUT request creating related objects rather than just updating them
- Subject: Re: REST PUT request creating related objects rather than just updating them
- From: Catarina Simões <email@hidden>
- Date: Sat, 23 Feb 2013 19:36:31 +0000
Hi Jesse and all,
First of all I'm using the method update from ERXRouteController to update the object.
I was wrong when I thought the objects in the relationships (object1 and object2 in my example) were being created by this update method. They are not created but the previous objects in the relationships are being updated with object1 and object2 information.
All I want is just to replace the existing objects in the relationships by these ones (that already exist in the database).
Can ERXRouteController update with the right filter do that or do I have to handle the request myself and update the object and replace the relationships by the new ones? In the first case which filter can be used?
Thanks in advance.
Best regards,
Catarina
A 18/02/2013, às 17:23, Jesse Tayler <email@hidden> escreveu:
>
> Whoops.
>
> Update, yes.
>
> Create? No.
>
> You need to create objects separately and create each related object one at a time - not like transaction w/rollback
>
> Make sense?
>
> On Feb 18, 2013, at 12:14 PM, Jesse Tayler <email@hidden> wrote:
>
>> yes.
>>
>>
>>
>>
>> On Feb 18, 2013, at 12:06 PM, Catarina Simões <email@hidden> wrote:
>>
>>> Hi all,
>>>
>>> I'm using RestKit and ERRest to access services provided from a web app in WO to a OS X app.
>>> I'm doing a PUT to update an object that has several one-to-one relationships. The request sent by RestKit is something like this:
>>> {
>>> "attrib1": "attrib1 value",
>>> "attrib2": "attrib2 value",
>>> "object1": {
>>> "id": 2,
>>> "name": "some name"
>>> },
>>> "id": 1,
>>> "object2": {
>>> "id": 1,
>>> "name": "some other name",
>>> "description": "some description"
>>> }
>>> }
>>>
>>> On the WO side the object attributes are updated but also both object1 and object2 are created rather than just updating the relationship to those objects.
>>> The filter I'm using in the update includes all the attributes to the object being updated and also the 2 relationship objects and corresponding attributes.
>>>
>>> Shouldn't the WO side recognize the objects in the relationships, fetch them and traverse the relationships and update the already existing objects?
>>>
>>> Thanks in advance.
>>> Best regards,
>>> Catarina
>>> _______________________________________________
>>> 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
_______________________________________________
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