• 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
Re: ERRest: Multiple entries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERRest: Multiple entries


  • Subject: Re: ERRest: Multiple entries
  • From: Fred Opims <email@hidden>
  • Date: Sat, 29 Aug 2015 15:29:33 -0400

Hi Marc!
Thank you very much for this response. I will try it and let you know !
Have a good week end !
Ruddy 

On Friday, August 28, 2015, Mark Wardle <email@hidden> wrote:
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@hidden> 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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: ERRest: Multiple entries (From: Mark Wardle <email@hidden>)

  • Prev by Date: Re: ERRest: Multiple entries
  • Next by Date: SAML 2.0
  • Previous by thread: Re: ERRest: Multiple entries
  • Next by thread: SAML 2.0
  • Index(es):
    • Date
    • Thread