Consuming External Rest API in Oracle Integration Cloud service

To all the learning enthusiasts, In this article, I will be sharing the steps required to consume external Rest API in the Oracle Integration Cloud Service Instance.

Before we hop into the steps, let's understand the use case of this particular integration.

Use Case: This sample integration will use External Rest API  https://reqres.in/api/users  as source URL with GET operations to access the data and generate REST URL in OIC instance. 




Step 1: The first step would be to create a connection 

Go to Integrations-->Connections--> Create




Select REST in the Create Connection wizard list. 



Select the Role as Trigger in the connection and click on Create Button





Select the security as "Basic Authentication"  and click on Test and then Save it 



A trigger base connection has been created to trigger the REST URL. Now next step would be to create the INVOKE connection to invoke the external REST API URL













Provide information such  as 

Connection Type: "Rest API Based URL"
Connection URL:  "https://reqres.in/api"
Security Policy:  "Basic Authentication"





Step 2: Once connections are created, the next step is to create integration






Select App Driven Orchestration as Integration Style



















Fill out relevant required details 































Select the Trigger connection as depicted in the below screenshot. 



















Provide the end point name which you want to call it as "GetEmpDetails" and click on Next































provide the resource URI as /myusers , This will be the endpoint URL



Click on Next  and Select response payload as JSON




Copy the below payload in the Inline  and click on OK

[ {
  "Myid" : 1,
  "Myemail" : "george.bluth@reqres.in",
  "Myfirst_name" : "George",
  "Myemaillast_name" : "Bluth",
  "Myavatar" : "https://reqres.in/img/faces/1-image.jpg"
} ]







Click on Next to verify the configuration summary 



























Once trigger connection formed in the intergration , now the next step is to drop the Invoke connection 


Provide the endpoint name as "InvokeUsers" and resource URL should be actuall URI of the External URI which we will be invoked in this integration. 

External URL:   https://reqres.in/api/users
Resource uri would be : /users





click on next and select response payload as JSON




Sample Payload 

{
  "id" : 1,
  "email" : "george.bluth@reqres.in",
  "first_name" : "George",
  "last_name" : "Bluth",
  "avatar" : "https://reqres.in/img/faces/1-image.jpg"
]





Click on Next and Done 




























Next step is to create a mapping by dropping Map component to the console as depicted in the screenshot.



















Map the relevant relevant fields as shown in the screenshot. 






click on the Tracking 




Drag the request path to the Tracking Field and give Tracking Name whatever relevant you feel , in my case i gave as id


















Next step is to Activate the integration












Run the integration









Test the integration by clicking on the endpoint URL













Upon click on the link , you will be asked to enter the credentials. Enter you OIC credentials 




















Here you go with external API Response. Congratualtions! for your First OIC integration. 





Comments

Popular posts from this blog

Sample HZ API's script to Create Contacts and Contact Points in Oracle

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