Import and Export Data From the Command Line

You can perform bulk import and export of data from the command line using Visual Builder APIs.

The Visual Builder APIs are accessible from the command line to an application’s team members using basic authentication, just as the data APIs can be used to query individual objects and perform single-row operations. For example, you can set up a daily cron job to import and export data and synchronize the data in your business objects with data in another table.

Import Data from the Command Line

To import data into a business object from the command line, you use a POST method with the /resources/datamgr/import endpoint.

You will need to upload .csv, .xls, or .xlsx files containing the data. The file name must match the object ID of the business object that you want to update. To import data for a single business object, you can upload a single file. When importing data for multiple business objects, you will need to upload a ZIP archive containing one or more .csv, .xls, or .xlsx files.

Query Parameter

The import endpoint only accepts the append parameter:
Parameter Description
append Boolean, which if true adds the rows in your file as new rows to the business object. The default value is false, which results in your file's data replacing existing data in the business object.

Syntax

To import data for all business objects in an application, you would use a POST method as follows:
POST https://host:port/ic/builder/design/yourApp/appVersion/resources/datamgr/import
For example, to import data into all business objects for version 1.0 of the MyApp application, use:
POST https://myserver:myport/ic/builder/design/MyApp/1.0/resources/datamgr/import
Remember to upload the data file you want to import and indicate its content type in the request body. If you were using REST API tools similar to Postman, for example, you would use the Body tab to upload the data file (say, MyObject.zip) and select binary as the content type.
To import data for a specific business object, you would use a POST method as follows:
POST https://host:port/ic/builder/design/yourApp/appVersion/resources/datamgr/import/objectId
For example, to import data into the MyObject business object in version 1.0 of the MyApp application, use:
POST https://myserver:myport/ic/builder/design/MyApp/1.0/resources/datamgr/import/MyObject

Note:

To import data to the staging or live database, replace /design/ with /deployment/ in the endpoint path.

If your application is live, use the options menu to lock the application before you import data. Unlock the application after you finish.

cURL Commands

If you were using the cURL command-line tool to import development data for a business object named MyObject in version 1.0 of the MyApp application, you would use a POST method as follows:
curl -X POST -u user:password https://host:port/ic/builder/design/MyApp/1.0/resources/datamgr/import/MyObject -H Content-Type:text/csv -T MyObject.csv -v
To import development data for multiple business objects in version 1.0 of the MyApp application, you would use a POST method as follows:
curl -X POST -u user:password https://host:port/ic/builder/design/MyApp/1.0/resources/datamgr/import  -H Content-Type:application/zip -T myObject.zip -v 
If you were using the cURL command-line tool to import data to the staging or live database for a business object named MyObject in version 1.0 of the MyApp application, you would use a POST method as follows:
curl -X POST -u user:password https://host:port/ic/builder/deployment/MyApp/1.0/resources/datamgr/import/MyObject -H Content-Type:text/csv -T MyObject.csv -v

Export Data from the Command Line

To export a business object's data from the command line, you use a GET method with the /resources/datamgr/export endpoint.

Syntax

To export development data from all business objects in an application, you would use a GET method as follows:
GET https://host:port/ic/builder/design/yourApp/appVersion/resources/datamgr/export
For example, to export development data from business objects in version 1.0 of the MyApp application, use:
GET https://myhost:myport/ic/builder/design/MyApp/1.0/resources/datamgr/export

Exporting the application's data results in a ZIP archive that contains a .csv file for each business object in the application.

To export development data for a specific business object, you would use a GET method as follows:
GET https://host:port/ic/builder/design/yourApp/appVersion/resources/datamgr/export/objectId

For example, to export development data from the MyObject business object in version 1.0 of the MyApp application, use:

GET https://myhost:myport/ic/builder/design/MyApp/1.0/resources/datamgr/export/myObject

Exporting the data in a single business object results is a .csv file containing the data in the specified business object.

Note:

To export data to the staging or live database, replace /design/ with /deployment/ in the endpoint path.

If your application is live, use the options menu to lock the application before you export data. Unlock the application after you finish.

cURL Commands

If you were using the cURL command-line tool to export development data for version 1.0 of the MyApp application to a ZIP archive named myapp.zip, you would use a GET method as follows:
curl -u user:password https://host:port/ic/builder/design/MyApp/1.0/resources/datamgr/export > myapp.zip

This command creates a .zip file, myapp.zip, which will contain a .csv file for each business object in MyApp.

If you were using the cURL command-line tool to export staging or live data for version 1.0 of the MyApp application to a ZIP archive named myapp.zip, you would use a GET method as follows:
curl -u user:password https://host:port/ic/builder/deployment/MyApp/1.0/resources/datamgr/export > myapp.zip