Visual Builder Cloud Service (VBCS) makes it very easy to create custom objects to store your data. A frequent request we get is for a way to load and export data from these business objects. As John blogged, we added a feature to support doing this through the command line - John's blog shows you the basic options for the command line.
I recently needed to do this for a customer, and thought I'll share some tips that helped me get the functionality working properly - in case others need some help skipping bumps in the road.
Here is a demo showing both import and export and how to get them to work.
Export is quite simple - you use a GET operation on a REST service, the command line for calling this using curl will look like this:
curl -u user:password https://yourserver/design/ExpImp/1.0/resources/datamgr/export > exp.zip
The result is a streaming of a zip file, so I just added a > exp.zip file to the command's end. The zip file will contain CSV files for each object in your application.
Don't forget to replace the bold things with your values for username and password, your VBCS server name and the name of the app you are using (ExpImp in my case).
Having the exported CSV file makes it easy to build a CSV file for upload - in the demo I just replaced and added values in that file. Next you'll use a similar curl command to call a POST method. It will look like this:
curl -X POST -u user:password https://yourserver/design/ExpImp/1.0/resources/datamgr/import/Employee?filename=Employee.csv -H "Origin:https://yourserver" -H "Content-Type:text/csv" -T Employee.csv -v
A few things to note.
You need to specify which object you want to import into (Employee after the /import/ in the command above), and you also need to provide a filename parameter that tell VBCS which file to import.
In the current release you need to work around a CORS security limitation - this is why we are adding a header (with the -H option) that indicate that we are sending this from the same server as the one we are running on. In an upcoming version this won't be needed.
We use the -T option to attach the csv file to our call.
Note that you should enable the "Enable basic authentication for business object REST APIs" security option for the application (Under Application Settings->Security).
In the samples above we imported and exported into an application that is still being developed - this is why we used the /design/ in our REST path.
If you want to execute things on an application that you published then replace the /design/ with /deployment/
One special note about live applications, before you import data into them you'll need to lock them. You can do this from the home page of VBCS and the drop down menu on the application.