The Integration blog covers the latest in product updates, best practices, customer stories, and more.

OIC Backups

John Graves
PaaS Cloud Integration Architect

This is a quick post for those who like to back up data, including OIC flows.

The OIC REST API is pretty simple to use and follow, but it may not be obvious how to backup all your flows, so here is a script.

NOTE: This is just for the integration flows an not for PCS or VBCS.

There are two APIs used here:

Retrieve Integrations and Export an Integration.

The high-level steps are:

  1. Get count of how many integrations exist
  2. Since you are limited to retrieving 100 flow details at a time:
    Loop for every 100 flows
  3. Export each flow

If you'd like to use this script, just modify the top few lines to point to your instance of OIC and your AUTH string.  It's pretty easy to get the AUTH string by just looking at the developer console when you login to OIC.

export SERVER_URL="https://...oraclecloud.com"
export AUTH="..."

Once the IAR is extracted, it is pretty easy to the expand it and check the code into GIT or DevCS.

I hope this can be useful to others.



# Update these as needed
# If proxy used:
#export HTTPS_PROXY=http://www-proxy-...:80
#export HTTP_PROXY=http://www-proxy-...:80
export SERVER_URL="https://...oraclecloud.com"
export AUTH="...=="
export offset=0

# This shouldn't need to be modified unless you uncomment the extract and possibly a git update if using DevCS
export totalCount=$(curl -s --location --request GET ${SERVER_URL}'/ic/api/integration/v1/integrations?limit=1' --header 'Authorization: Basic '${AUTH} | jq -r '.totalResults')
echo "Total Results: "${totalCount}

while [ ${offset} -lt ${totalCount} ]
 for row in $(curl -s --location --request GET ${SERVER_URL}'/ic/api/integration/v1/integrations?offset='${offset}'&limit=100' --header 'Authorization: Basic '${AUTH} | jq -r '.items[] | @base64')
   _jq() {
     echo ${row} | base64 --decode | jq -r ${1};
   export offset=$((offset+1))
   echo ${offset}"/"${totalCount}": Exporting: "$(_jq '.id')
   id=$(_jq '.id');
   name=$(_jq '.name');
   curl -X GET -k -s -H 'Authorization: Basic '${AUTH} -o ${idOutput}.iar ${SERVER_URL}'/ic/api/integration/v1/integrations/'${id}'/archive'
   # Here the IAR can be extracted and checked into GIT, DevCS, etc
   #  mkdir -p Integrations
   #  cd Integrations
   #  mkdir -p ${name}
   #  cd ${name}
   #  jar xvf ../../${idOutput}.iar
   #  cd ../..



Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.