Friday, June 3, 2022

OIC - Import an OIC integration using REST API | Import an Integration | REST API for Oracle Integration Migration | How to use multipart/form-data media type in REST adapter

Use Case: Import an already exported OIC integration using Oracle provided REST APIs.

Integration style: App Driven Orchestration

Connections used:

  • Rest Trigger
  • Rest OIC self Invoke connection
  • FTP 

Verb used: POST

REST API used:/ic/api/integration/v1/integrations/archive

For how to export an integration using REST API, follow my blog:

https://soalicious.blogspot.com/2022/05/oic-export-integration-using-rest-api.html

Oracle provided Rest api links:

We can get all the Rest APIs in docs.oracle.com site under integrations section.

https://docs.oracle.com/en/cloud/paas/integration-cloud/rest-api/index.html

Flow details:


  1. The Integration will take 2 request parameters Identifier and Version and 1 response parameter as Status.
  2. It will calll FTP adapter to poll the exported .iar file using the file name as concat(Identifier,"_",Version,".iar")
  3. It will then call the OIC REST self connection and use IMPORT REST API URI and choose multipart/form-data media type and map the ftp response .iar file reference to attachment reference to import the file to OIC instance.
  4. During import call mapping, we added the following:
    1. Read file response (file reference) >> Attachment Reference
    2. Content-Type: "multipart/form-data"
    3. File Input Html Field Name: "file"

Steps with POC Screenshots:

Rest Trigger config:













Already exported .iar file polling using FTP adapter









Call OIC Self REST adapter and configure to import integration






Map a status like " Success" or based on the import response we can take a switch and take decision for the status.



Add Tracking



Delete the integration which is already exported and to import again using this POC
 

We can see the exported files.


Test with the inputs.


Check Activity stream.



See response status = 204 that means its successfully imported to OIC instance.


Hurrah!! Its imported and in configured state.


Now change the state from Configured to Active and check and configure all the imported connections, lookups etc.

Similarly, we not only can export and import integrations using REST apis, there are others functions like delete/clone/import replace/retreive errors/retrieve status/update integrations and same we can do for connections, lookups, Libraries etc.




No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...