Call the REST service and Servoy will populate the data

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?

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…

//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:

goldcougar:
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)

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