• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Map an Object in ERRest
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Map an Object in ERRest


  • Subject: Map an Object in ERRest
  • From: Rodrigo de Sousa <email@hidden>
  • Date: Wed, 08 Jun 2016 16:22:00 -0400

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@hidden",
        "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@hidden",
                    "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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Map an Object in ERRest
      • From: Samuel Pelletier <email@hidden>
  • Prev by Date: Re: Streaming of WOWODC 2016
  • Next by Date: Re: Map an Object in ERRest
  • Previous by thread: Re: GROUP BY query
  • Next by thread: Re: Map an Object in ERRest
  • Index(es):
    • Date
    • Thread