Tuesday, December 17, 2024

#1051 - OIC Factory API for Project deployment

Introduction

This post details how to use the OIC Factory apis to export projects from one OIC instance, say Dev, and then import the aforementioned into another OIC instance, let's call it Test.

Basic Import/Export

Here is my project in the Dev Instance - 

3 integrations and 2 connections - 

I use the following api to export the project -

https://design.integration.myDC-1.ocp.oraclecloud.com/ic/api/integration/v1/projects/AA_PROJECT_API/archive?integrationInstance=myOICDevInstance 

I execute the request in Postman - 

Then I save the result to a file - 

I now import the project using the api -

https://design.integration.myDC.ocp.oraclecloud.com/ic/api/integration/v1/projects/archive?integrationInstance=myOICTestInstance

I check it out in my test OIC instance - 

The Fusion ERP connection is set to draft, as the connection details are not exported - 

I can use the following api to get the project connections - 

I can run this against the source instance, my Dev OI instance.

https://design.integration.myDC.ocp.oraclecloud.com/ic/api/integration/v1/projects/AA_PROJECT_API/connections?integrationInstance=myOICDevInstance



Next API call is to retrieve that particular connection, FUSION_ERP -


https://design.integration.myDC.ocp.oraclecloud.com/ic/api/integration/v1/projects/AA_PROJECT_API/connections/FUSION_ERP?integrationInstance=myOICDevInstance

I now need to update the connection, in the project on my OIC Test instance.

for example, I need to add the Fusion Apps url, user and password - 

Here is the api I will use for this - 

https://design.integration.myDC.ocp.oraclecloud.com/ic/api/integration/v1/projects/AA_PROJECT_API/connections/FUSION_ERP?integrationInstance=myOICTestInstance

Here is the payload - 

{  

      "connectionProperties": [

        {

            "displayName": "ERP Cloud Host",

            "hasAttachment": false,

            "hiddenFlag": false,

            "propertyDescription": "...",

            "propertyGroup": "CONNECTION_PROPS",

            "propertyName": "Host",

            "propertyShortDesc": "https://<customer_chosen_domain_name>.fa.<DC>.oraclecloud.com",

            "propertyType": "URL",

            "propertyValue": "https://myFusionERP-fa.oraclepdemos.com",

            "requiredFlag": true

        }

    ],

     "securityProperties": [

        {

            "displayName": "Username",

            "hasAttachment": false,

            "hiddenFlag": false,

            "propertyDescription": "A username credential",

            "propertyGroup": "CREDENTIALS",

            "propertyName": "username",

            "propertyShortDesc": "Use UserName",

            "propertyType": "STRING",

            "propertyValue": "casey.brown",

            "requiredFlag": true

        },

        {

            "displayName": "Password",

            "hasAttachment": false,

            "hiddenFlag": false,

            "propertyDescription": "A password credential",

            "propertyGroup": "CREDENTIALS",

            "propertyName": "password",

            "propertyShortDesc": "Enter Password",

            "propertyType": "PASSWORD",

            "propertyValue": "Welcome1",

            "requiredFlag": true

        }

    ]

}

The following header is also required -

Now the connection is configured - 

Final step is to activate the integrations - 

https://design.integration.myDC.ocp.oraclecloud.com/ic/api/integration/v1/projects/AA_PROJECT_API/integrations/SHIPORDER|01.00.0000?integrationInstance=myOICTestInstance

We also need the following header and body -  

The response - 

I validate in OIC - 

The integration activation REST API also supports a request parameter - enableAsyncActivationMode. This ensures the invoke does not wait for the activation to complete. 

Handling Project Updates

Now a change has been made to our project in the Dev instance - this needs to be pushed to Test.

I need to update my Test OIC instance accordingly. First step is to delete the project in the Test instance -

The request fails, as I have an activated integration, SHIPORDER, in my project. Here I use the update an integration in a project api, this time with status set to CONFIGURED.




I validate in my OIC Test instance -

Now I execute the project delete api again - 

Now I can start afresh, as detailed in the Basic Export/Import section above. 

Summa Summarum

Promoting OIC Projects form one instance to another is easy with the OIC Factory api. The full Factory api doc are here.














No comments: