Re: REST Relationship
Re: REST Relationship
- Subject: Re: REST Relationship
- From: Pascal Robert <email@hidden>
- Date: Thu, 20 Dec 2012 12:51:39 -0500
Le 2012-12-20 à 10:03, gabor raz <email@hidden> a écrit :
> Hi,
>
>
> I try to create a REST interface for a application. And my problem know is i don't understand how to set relationships.
> I tried it like in the ERRestRouteExample with the updateAction.
>
> ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
> filter.include( AppointmentRequest.TO_DECLINE_REASON );
>
> AppointmentRequest request = appointmentRequest();
> update( request, filter );
> editingContext().saveChanges();
>
> return response( request, filter );
>
> My JSON data look like this.
> { toDeclineReason:{ oid: 2 } }
>
> But now I got the message back that I have to provide the "Display Name" which is a attribute of the entity DeclineReason.
> Is there another way to set the relationships?
Either use ERXKeyFilter.filterWithAttributesAndToOneRelationships() if you want all attributes of DeclineReason (if it's a 1:1 relationship), or:
ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
filter.include(AppointmentRequest.DECLINEREASON.dot(DeclineReason.DISPLAY_NAME));
_______________________________________________
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