Best practice for RESTful web services POST.

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

Best practice for RESTful web services POST.

Postby AlanBourke » Thu Sep 24, 2015 1:59 pm

Imagine I am implementing a RESTful web service with Servoy which will add customer records to the database. I might want to send in 10 or 20 new customers in a run.


In terms of how Servoy implements these (headless client etc.) is it:

(a) More efficient to send in all 20 at once, i.e. have the web service deserialise and process the 20, but then have to implement some way of informing the caller as to which failed (if any).
(b) More efficient to send them in one at a time, and process the response for each, and let Servoy's pooling and resource management handle the repeated calls.
(c) it doesn't really matter either way in terms of efficiency on the Servoy side.

Thanks
-------------------------------------------------------------------------------------------
Servoy SAN Developer
User avatar
AlanBourke
 
Posts: 195
Joined: Tue Aug 02, 2011 3:32 pm
Location: Dublin, Ireland

Re: Best practice for RESTful web services POST.

Postby mboegem » Thu Sep 24, 2015 2:54 pm

Hi Allen,

Setting up 1 request/connection with more data would be more efficient, if only it was for processing multiple records into a foundset and calling databaseManager.saveData() just once...

As for the part of returning the result:
https://wiki.servoy.com/display/DOCS/RESTful+Web+Services#RESTfulWebServices-SupportingPOSTRequests

The method can optionally return a JavaScript primitive/array/object or a byte array.
If the return value is a JavaScript object, it will be serialized and then placed in the body of the HTTP Response. See Returning Binary Data for more info on returning binary content.


Hope this helps
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1382
Joined: Sun Oct 14, 2007 1:34 pm
Location: Hoofddorp, The Netherlands

Re: Best practice for RESTful web services POST.

Postby AlanBourke » Thu Sep 24, 2015 3:05 pm

That's what I felt, thanks.
-------------------------------------------------------------------------------------------
Servoy SAN Developer
User avatar
AlanBourke
 
Posts: 195
Joined: Tue Aug 02, 2011 3:32 pm
Location: Dublin, Ireland


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 1 guest

cron