Saturday, 27 October 2018

Oracle Integration Cloud: CRUD Operation (Get by Id) using Salesforce Adapter (Part-3)

In the previous blog of the series, we have showcased how to Insert details into SFDC using Oracle Integration Cloud Salesforce Adapter.

In this third part of the series, we'll demonstrate the Get employees details by Id using Salesforce adapter in Integration Cloud.

Use Case: Expose a REST API in Integration Cloud which will fetch the employee details based on the 18 digits SFDC Id from Salesforce

Others part of the Series

                                                                                                  


The integration will look like POST completion

Let's get started and complete the GET operation
  • Create an Integration and Select the App Driven Orchestration pattern
  • Provide the integration name as GetEmployees
  • Drop or Select the REST connection on the integration canvas as a Trigger point
  • Provide the information as below and click the Next button
    • What do you want to call your endpoint: GetEmployee
    • What is the endpoint's relative resource URI?: /employees/{employeeid}
    • What action do you want to perform on this endpoint: GET
    • Check the checkbox Configure this endpoint to receive the response
  • On the Response page, enter below information and click the Next button
    • Select JSON Sample from the request payload format drop-down, click <<inline>> link and enter below sample JSON payload
{
   "Employees"[
      {
         "EmployeeName""",
         "EmployeeEmailId""",
         "EmployeeAge"11,
         "EmployeeQualification"""
      },
      {
         "EmployeeName""",
         "EmployeeEmailId""",
         "EmployeeAge"11,
         "EmployeeQualification"""
      }
   ]
}




  • Drop an SFDC adapter just below the REST adapter

    • Enter below information and click the Next button
      • What do you want to call your endpoint?: FetchEmployees
      • Check the Standard applications delivered by Salesforce.com checkbox
    • Enter below information and click the Next button
      • Select CRUD, retrieve operation from the Operation Type drop down
      • Search Object (employee) and move the Employee__c SFDC object to the selected pane
    • Click the Next button
    • Edit the FetchEmployees mapper and map the fields as below
      • employeeid --> ids
      • Edit the fieldList element and enter below fields
    Employee_Age__c,Employee_Email_id__c,Employee_Name__c,Employee_Qualification__c

    • Edit the GetEmployee mapper
    • Map the fields from the source (SFDC) to target(REST)


    • Integration is completed now. Save and Activate the integration
    • Let's test the integration. Since this is the GET operation, so the service can be tested via browser also. Enter the REST endpoint URL and submit
    Ist Test

    https://oicinstance-test.integration.ocp.oraclecloud.com/ic/api/integration/v1/flows/rest/GETEMPLOYEES/1.0/employees/a006F000036ZutsQAC

    2nd Test:

    https://oicinstance-test.integration.ocp.oraclecloud.com/ic/api/integration/v1/flows/rest/GETEMPLOYEES/1.0/employees/a006F000036ZuttQAC




    No comments:

    Post a Comment