Sunday, 23 September 2018

CRUD Operation in Oracle Integration Cloud (Part-4)

This is the fourth part of DB CRUD operation in Oracle Integration Cloud(OIC).

Use Case: Create a REST service which will update a user record based on Id

Follow the article for the pre-requisite.

Let's get started and implement the use case
  • Login in the Oracle Integration Cloud and navigate to the Integration tab
  • Click on Create button and select App Driven Orchestration template
  • Enter the Integration Name as DB_Update and click on Create button
  • Select Rest_Trigger_conn
  •  Enter below information and click Next button
    • What do you want to call your endpoint: UpdateUser
    • What is the endpoint's relative resource URI?: /users
    • What action do you want to perform on the endpoint: PUT
    • Add and review parameters for this endpoint: Select this checkbox
    • Configure a request payload for this endpoint: Select this checkbox
    • Configure this endpoint to receive the response: Select this checkbox
  • Add Query Parameters as UserId of type integer and click Next button
  • Select JSON Sample from the drop down and then click on <<<inline>>> link
{
   "User":{
      "FIRSTNAME":"",
      "LASTNAME":"",
      "DESG":"",
      "QUAL":""
   }
}

  • Select JSON Sample from the drop down and then click on <<<inline>>> link and enter below json
{
    "status": ""
}

  • Just complete the wizard
  • Select Test_DB_Connection
  • Enter below details and click Next button
    • What do you want to call your endpoint: UpdateUsers
    • What operation do you want to perform?: Perform an Operation On a Table
    • Select the Update radio button
  •  Select below information and click Import Tables button
    • Schema: HR
    • Table Type: TABLE
    • Table Name: Enter %USER% and click the Search button
    • Select USER_MASTER table from Available pane and move to the Selected pane
  • Click Next button 
  • Edit the UpdateUser mapper and map the fields 

  •  Drag a mapper just below the DB adapter and hardcode the value of status as "User Updated Successfully"
Now the configuration is completed. Just save the integration and Activate.

This is the time to test the REST service. POSTMAN client will be used the test the service. Enter the REST service endpoint in the POSTMAN and add BASIC authentication.

Add below JSON payload and hit Send button

{
   "User":{
      "FIRSTNAME":"Ankur_updated",
      "LASTNAME":"Jain_Updated",
      "DESG":"TL",
      "QUAL":"MCA"
   }
}


Open the DB table and confirm if the record has been updated


No comments:

Post a Comment