Hi, I think your only solution is to create a custom NSDictionary with the required key and return it like this:
NSMutableDictionary<String, Object> result = new NSMutableDictionary<String, Object>(); result.setObjectForKey(someObject.federalDocument(), "federalDocument"); result.setObjectForKey(someObject.customer(), "customer"); return response(result, ERXKeyFilter.filterWithAllRecursive()); This will returns all attributes and relationships of customer, adjust the filter if required. Samuel > Le 8 juin 2016 à 16:22, Rodrigo de Sousa <[email protected]> a écrit : > > Hello, > > I am using the ERRest in my project and I am having a problem. I changed some > attributes to a new relationship, but I want to discover if there is a way to > not change my old API request. > > For example: > > Old request: > { > "customer": { > "email": "[email protected] <mailto:[email protected]>", > "name": "Rodrigo de Sousa", > "phone": "11 1234-5678" > }, > "federalDocument":"123123123" > } > > Now, I have a new relationship called Sale Detail that have a customer. > > New request: > { > "saleDetail": { > "customer": { > "email": "[email protected] <mailto:[email protected]>", > "name": "Rodrigo de Sousa", > "phone": "11 1234-5678" > }, > "federalDocument":"123123123" > } > } > > I know that I can use the ERXKeyFilter.filterWithAllRecursive() and add in > the map like in the example below. It works well with primitive attributes, > but I can use some like this with an Object (in my case, the Customer)? Is > possible to continue using the old request and not break my API? > > Example: > filter.addMap("saleDetail.federalDocument", "federalDocument"); > > With this example, I can use the federalDocument in the old way. I tested > here and it works. > > I can use some like in the example below? > > Example: > filter.addMap("saleDetail.customer", "customer"); > > When I tried to use this, this exception was thrown: > > java.lang.IllegalArgumentException: There is no to-one relationship named > 'saleDetail.customer' on 'CommercialInvoice'. > at > er.rest.ERXRestRequestNode.updateObjectWithFilter(ERXRestRequestNode.java:1296) > at > er.rest.ERXRestRequestNode.createObjectWithFilter(ERXRestRequestNode.java:863) > at er.rest.routes.ERXRouteController.create(ERXRouteController.java:670) > at er.rest.routes.ERXRouteController.create(ERXRouteController.java:638) > > Thanks for any help! > Rodrigo. > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list ([email protected]) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com > > This email sent to [email protected]
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
