DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Building a REST Service That Collects HTML Form Data Using Netbeans, Jersey, Apache Tomcat, and Java
  • Building REST API Backend Easily With Ballerina Language
  • Consuming REST APIs With React.js
  • Build Reactive REST APIs With Spring WebFlux

Trending

  • The Rise of the Intelligent AI Agent: Revolutionizing Database Management With Agentic DBA
  • 10 Predictions Shaping the Future of Web Data Extraction Services
  • Build Real-Time Analytics Applications With AWS Kinesis and Amazon Redshift
  • Squid Game: The Clean Code Trials — A Java Developer's Survival Story
  1. DZone
  2. Data Engineering
  3. Data
  4. Exporting and Importing Data From VBCS With REST Calls

Exporting and Importing Data From VBCS With REST Calls

See how you can move data into and out of your Oracle Visual Build Cloud Service apps in Dev or Prod using some REST calls from the command line.

By 
Shay Shmeltzer user avatar
Shay Shmeltzer
·
Nov. 06, 17 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
7.0K Views

Join the DZone community and get the full member experience.

Join For Free

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 Ceccarelli 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'd 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.


Exporting Data

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).

Importing Data

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 tells 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 indicates 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).

Using Import in Production Apps

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.

REST Web Protocols Data (computing)

Published at DZone with permission of Shay Shmeltzer, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building a REST Service That Collects HTML Form Data Using Netbeans, Jersey, Apache Tomcat, and Java
  • Building REST API Backend Easily With Ballerina Language
  • Consuming REST APIs With React.js
  • Build Reactive REST APIs With Spring WebFlux

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: