Create a REST API in OIC Service to insert data in OnPrem Database

Use case: In this case study, we will be creating a REST API to insert data into On-Premise Database Instance.

Prerequisites


1. REST adapter
2. OIC Database Adapter


Below Schematic explains REST API will be invoked through REST Adapter and further connect the Database adapter via agents to insert data into the system 




 


Let's navigate to the service console and click on Integrations and also click on Create



Select Integration Style

App Driven Orchestration



Fill the mandatory details 


drop the rest Trigger from Pallet 




Click on Next after providing the endpoint Name 


Select appropriate URI name  and choose POST as endpoint URI



Provide Sample JSON , It is required for mapping 





{
"UserData":[
        {
         "id":"",
         "firstname":"",
         "lastname":"",
"email":"",
         "qualification":""
      },
      {
         "id":"",
         "firstname":"",
         "lastname":"",
"email":"",
         "qualification":""
      }
  ]
}

After pasting the sample , then click on OK




Also paste the response sample JSON sample Payload 

{
  "status" : ""
}



Click on  Done 




Now let's drop On-Prem Database on the workspace and create mapping out of it 











Configure On-Premise Database Instance by selecting an operation and Table in which you want to insert the data 





Select the Table XX_OIC_EMP 





Click on Import Tables






Select the columns and click on Ok






Click on Next 



Click on Done 





Map the data as shown in the screenshot 





Now next step is to create mapping for the response 





Click on Status and create a Target Node 






Edit the Target Node and Type keyword as Success which means for every successful insertion API will return the Success message as a response 



Enable the tracking field and provide unique identifier 







Here the unique identifier is the ID we will be considering


Next step is to turn on the integration 





Click on Test



Put below response in body  and test it 


{
"UserData":[
        {
         "id":"1",
         "firstname":"Pranay",
         "lastname":"Tiwari",
"email":"test123@oracle.com",
         "qualification":"Senior Integration Consultant"
      },
      {
         "id":"2",
         "firstname":"Eric",
         "lastname":"Rose",
"email":"test1245@oracle.com",
         "qualification":"Integration Architect"
      }
  ]
}





Here you go with records 




You can call this REST API in Postman or Advance Rest Client too 


{
"UserData":[
        {
         "id":"1",
         "firstname":"Mike",
         "lastname":"Wess",
 "email":"Smple123@oracle.com",
         "qualification":"Senior  Consultant"
      },
      {
         "id":"2",
         "firstname":"Bernedette",
         "lastname":"Ramsay",
 "email":"ohio12@oracle.com",
         "qualification":"Integration Expert"
      }
  ]
}

Copy the URL and paste the response  and enter the OIC credentials 



















Comments

Popular posts from this blog

REST integration built-in OIC to read Large files with size more than 10MB

Basic Concepts of OAF (Oracle Applications FrameWork )