Call the REST service and Servoy will populate the data

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Call the REST service and Servoy will populate the data

Postby swingman » Mon Jul 13, 2020 5:09 pm

Hi all,

I note the following on the Servoy website:

Non-SQL Data
Connecting to non-SQL data such as RESTful web services is just as easy as connecting to a database. The Servoy IDE allows you to define the data structure of your choice and start building the user experience and logic. Simply call the REST service and Servoy will populate the data at runtime.


I know how to define an in-memory data source and how to call a rest service using the http plugin.

Simply call the REST service and Servoy will populate the data at runtime.
So there is a simpler way. I can't seem to find anything about this in the Servoy documentation.

What is the shortcut to get Servoy to do as much as possible to create/populate the data structure?
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: Call the REST service and Servoy will populate the data

Postby sbutler » Tue Jul 14, 2020 2:14 pm

Here's what I do...

Assume you've connected to whatever non-sql data source you wanted, and you have the data in a JSDataSet...

Code: Select all
//create/replace an in-mem datasource ad-hoc at runtime
myDataSet.createdatasource('dataSourceName')

//save it so it shows up in the Datasources->In Memory area of the Servoy IDE
servoyDeveloper.save()


So, the save is something you do just once to get it created. Subsequent calls can just do the createdatasource with the same name, and it will just replace the data in the datasource. If the schema of the datasource changes, you can delete it and run it again with the servoyDeveloper.save() to get the schema to update with whatever the latest was from the raw source.

Simply call the REST service and Servoy will populate the data at runtime.

So, its not fully automatic that I know of, but with some code, you could iterate the JSON of a webservice response to figure out the datatypes, and then build a dataset.
So, marketing probably wrote that line above, or some new feature is available they haven't told us about yet. :wink:
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Call the REST service and Servoy will populate the data

Postby mboegem » Tue Jul 14, 2020 4:47 pm

goldcougar wrote:So, marketing probably wrote that line above, or some new feature is available they haven't told us about yet.


If I'm not mistaken, on ServoyWorld 2015, this was mentioned for being on the roadmap (don't know which one)
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Call the REST service and Servoy will populate the data

Postby swingman » Tue Jul 14, 2020 5:50 pm

So, its not fully automatic that I know of, but with some code, you could iterate the JSON of a webservice response to figure out the datatypes, and then build a dataset.
So, marketing probably wrote that line above, or some new feature is available they haven't told us about yet. :wink:


I think you are right about marketing ;-)

It is not hard to write this code manually, but it is repetitive.
Before writing more of these I just want to ensure there isn't some magic one-line call using the databaseManager or similar that I do not know about.

Christian
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London


Return to Programming with Servoy

Who is online

Users browsing this forum: Bing [Bot] and 8 guests