Hi Fred,

ERRest is just a set of convenience methods around direct actions. 

If you step through the code on how an update works, you could duplicate this 
to support multiple entries as you require.

So have a look at ERXRestRequestNode which gives you a format-agnostic tree of 
the body of the request. You could then manually parse that, iterate an array 
and then call the create method with the data.

        @POST
        
@Path("/patients/{patient:Patient}/encounters/{encounter:Encounter}/forms")
        public WOActionResults createFormAction(@PathParam("patient") Patient 
patient, @PathParam("encounter") Encounter encounter) {
                if (ERXEOControlUtilities.eoEquals(patient, 
encounter.patient())) {
                        ERXRestRequestNode documentNode = requestNode();

so if I were expecting an array, I might do this

for (ERXRestRequestNode child : documentNode.children()) {
        Object o = child.createObjectWithFilter(entityName, filter, 
restContext);
        //…. etc
}

I haven’t tested this - typing in email not eclipse - but if you examine the 
source code for ERRest, you should be able to do what you want. It just looks 
like magic because of all of the convenience methods (e.g. create() method).

b/w

Mark

> On 23 Aug 2015, at 21:08, Fred Opims <[email protected]> wrote:
> 
> 
> 
> Hello!
> 
> I'm using ERRest  and  to create an entry, I'm using the POST HTTP method 
> with JSON format.
> 
> For example, to create one entity User, I will execute the request with the 
> following post in the body {"name":"Fred"} as shown in the image:
> 
> 
> <Screen Shot 2014-08-26 at 3.25.41 PM.png>
> 
> Is there a way to create multiple entries in one time ?
> By multiples entries, i mean an array of the same object.
> 
> Let's say : 
> {"name":"Freddy"},
> {"name":"Eric"}
> {"name":"Andre"}
> ...
> {"name":"Pascal"}
> 
> I've tried to put the entries into an array but it does not work:
> [{"name":"Freddy"},{"name":"Eric"},{"name":"Andre"}]
> 
> How can I create 100 Users entities in one time ?
> 
> Thank you.
> 
> Fred
> _______________________________________________
> 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/mark%40wardle.org
> 
> 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]

Reply via email to