Friday, October 18, 2019

OIC: REST APIs Examples for managing Integrations

Expanding upon the last article I'm providing additional details and examples for using Oracle Integration Cloud REST APIs for managing your integrations. 

Note that for the examples below I will be using one of the pre-packaged integration named Hello World (version 1.2.000)

To limit the size of this posting I'm just providing examples only and limiting to common use-cases (small subset of the options). For additional details and completeness pls refer the official doc - REST API documentation


To get list of Integrations

curl -u username@email.password  -v -H "Content-Type:application/json" -H "Accept:application/json" -X GET https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations


Export one integration 

 curl -u username@email.password -X GET  -H "Content-Type:application/json" -o ./HELLO_WORLD_01.02.0000.iar_BAK https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations/HELLO_WORLD%7C01.02.0000/archive 





Import an Integration 

Note that 
curl -u username@email.password -X POST  -H "Accept:application/json" -F file=@HELLO_WORLD_01.02.0000.iar -F type=application/octet-stream https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations/archive

Note the following:

  • It is assumed that the iar (HELLO_WORLD_01.02.0000.iar) is in local directory from where the curl command is executed. If not, provide complete path. 
  • If the integration exists you will get error - HTTP 409 Conflict. If you like to replace the integration Use PUT verb (command below)

curl -u username@email.password -X PUT  -H "Accept:application/json" -F file=@HELLO_WORLD_01.02.0000.iar -F type=application/octet-stream https:/instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations/archive

Activate Integration

Create a file update.json from where you are running curl and add following line
{"status":"ACTIVATED"}

curl -u username@email.password -X POST  -H "Content-Type:application/json"  -H "X-HTTP-Method-Override:PATCH" -d @update.json https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations/HELLO_WORLD%7C01.02.0000

Note the following:

  • pass the flow ID with the version number separated by %7C (the encoded vertical line | character)
  • If the integration is already active you will get message - Integration "HELLO_WORLD | 1.2.0" is either already active, activation in-progress or not ready for activation
  • The above is blocking and will return after the activation is complete. To use unblocking call use the option as indicated below. 


curl -u username@email.password -X POST  -H "Content-Type:application/json"  -H "X-HTTP-Method-Override:PATCH" -d @update.json -d 'enableAsyncActivationMode=true' https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations/HELLO_WORLD%7C01.02.0000

De-activate Integration

Create a file update.json at location where you are running curl and enter the following line.
{"status":"CONFIGURED"}

Use the same command as shown as for Activation. For deactivation in the background pass additional parameter as indicated above. 

Clone Integration

Create a local file integration.json from the location where you execute the curl command and provide the cloned integration Name, ID, Version and description.  

{"code":"HELLO_WORLD_CLONE1","version":"02.00.0000","name":"Hello_World_Clone","description":"Description"}

curl -u username@email.password -X POST  -H "Content-Type:application/json" -d @integration.json  https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/integrations/HELLO_WORLD%7C01.02.0000/clone

Let me know if there are other API's that you are need help with.

1 comment:

Gary Kaufman said...

Hi Malkit. Hope you don't mind me reaching you this way. Had to be creative. I run a recruiting practice focused on Oracle talent. For one of my clients, need a consultant experienced in setting up OIC for a 12+ month engagement. I can best be reached at gary.kaufman@excellisearch.com of you can refer anyone.

Thanks
Gary

Understanding JavaScript Prototypal Inheritance for Java developers

Inheritance is a fundamental concept in programming languages. However, it is implemented differently in Object-Oriented Languages such as J...