Sunday, 23 September 2018

CRUD Operation in Oracle Integration Cloud (Part-5)

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

Use Case: Create a REST service which will delete 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_Delete and click on Create button


  • Select Rest_Trigger_conn

  • Enter below information and click Next button
    • What do you want to call your endpoint: UserDelete
    • What is the endpoint's relative resource URI?: /users
    • What action do you want to perform on the endpoint: DELETE
    • Add and review parameters 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 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: DeleteUser
    • What operation do you want to perform?: Run a SQL statement

  • Enter below SQL query and then Click Validate SQL Query

DELETE FROM USER_MASTER WHERE ID=#USER_ID


  • Edit the DeleteUser mapper


  • Map UserId => USER_ID 


  • Drop a mapper just below the DB adapter and hardcode the value of status as "User Deleted 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.


Open the Database table and verify the record with id 2 should be deleted


No comments:

Post a Comment