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
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
POST https://host:port/ic/builder/design/appName/appVersion/resources/datamgr/import
You can find your app's details on the Settings editor: look for appName in Application Name, and for appVersion, use the number that follows the dash in Application ID.
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.
POST https://host:port/ic/builder/design/appName/appVersion/resources/datamgr/import/objectId
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.
See also Data Management REST Endpoints in REST API for Oracle Visual Builder.
cURL Commands
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
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
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
GET https://host:port/ic/builder/design/appName/appVersion/resources/datamgr/export
You can find your app's details on the Settings editor: look for appName in Application Name, and for appVersion, use the number that follows the dash in Application ID.
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.
GET https://host:port/ic/builder/design/appName/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.
See also Data Management REST Endpoints in REST API for Oracle Visual Builder.
cURL Commands
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
.
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