Enter your keyword

post

Multiple resources with single REST: Oracle Integration

Multiple resources with single REST: Oracle Integration

Struggling on how to expose a REST API with multiple resources in Oracle Integration Cloud. Here is the article which will help you to expose such REST APIs.

This feature is restricted with Feature Flag “oic.cloudadapter.adapter.rest.mvrp” which should be enabled on OIC pod before you start implementing the article.

See the article on feature flag.

Let’s gets started and see how to achieve this advance feature.

Use Case

  • Expose a single REST API to perform two operations
    • Insert employee details in DB
    • Get employee details from DB

Once the integration is completed it will look like below

PICK action in OIC

Step by step procedure to achieve the use case

  • Create a App Driven Orchestration integration with name “EmployeeResource
  • Drop the REST connection as a trigger point, provide information as below and click checkbox
    • What do you want to call your endpoint? Employee
    • Enable multiple resources or verb checkbox
Pick Action in OIC
  • On the next screen, enter below details and click Next button
    • Provide an operation name: Insert
    • What is the endpoint’s relative resource URI? /emp
    • What action do you want to perform on the endpoint? POST
    • Check Configure a request payload for this endpoint checkbox
  • On the next screen, select JSON sample from drop down and enter sample json as below
{
               "Id": 1,
               "Name": "ABC",
               "Qualification": "MCA",
               "Gender": "M"
}
  • On the next screen, select Add another operation checkbox and select Next button. This step will allow you to add another resource on the same REST wizard.

The page will also show the summary of all resources you have added so far. If you would like edit/delete any resource just select the corresponding checkbox and simple click Next button.

Pick Action in OIC
  • On the next screen, enter below details and click Next button
    • Provide an operation name: Get
    • What is the endpoint’s relative resource URI? /emp/{id}
    • What action do you want to perform on the endpoint? Get
    • Check Configure this endpoint to receive the response checkbox
PICK action in OIC
  • On the response screen, choose JSON Sample option and add below json inline and click on Next button
{
              "Name": "ABC",
              "Qualification": "MCA",
              "Gender": "M"
}
  • Post this step the wizard will look like as below.
PICK action in OIC

On this page, you can add/edit/delete the resources as per your requirement.

  • Just click on Next button and finish the wizard. Post this step the integration will look like below
PICK action in OIC
  • Now add DB adapter in Insert and Get branch to complete the Operation

See the below YouTube playlist to see how to add DB operations.

https://www.youtube.com/watch?v=ORq7928ZRFs&list=PLlzOCTRJKR1LcUcxHMKM2n9jCk9E9v0_I
  • In order to add the tracking parameter, click on the trigger point, More Actions, select the Operation name
PICK action in OIC
  • Do the same for each resource. Save the integration and activate.
TEST the Integration with POST
TEST the Integration with GET

See the complete list of feature flag here

Leave a Reply

Your email address will not be published.