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:
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.
-John
-------------------------------------
#!/bin/bash
#
# 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} ]
do
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')
do
_jq() {
echo ${row} | base64 --decode | jq -r ${1};
};
export offset=$((offset+1))
echo ${offset}"/"${totalCount}": Exporting: "$(_jq '.id')
id=$(_jq '.id');
idOutput=${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 ../..
done
done
-------------------------------------