Configure Oracle Integration to Call Oracle Cloud Infrastructure Functions with the REST Adapter

The REST Adapter can integrate with Oracle Cloud Infrastructure services such as functions and object storage. As an example, assume you need to convert an existing image in object storage to a thumbnail format. You can design an integration in which a REST Adapter connection takes an application/octet-stream for an image, saves it to Oracle Cloud Infrastructure object storage, and sends the image to an Oracle Cloud Infrastructure function that creates a thumbnail and saves it back to object storage.

The following steps provide a high-level overview of creating this type of integration.

  1. Go to Developer Services > Functions in the Oracle Cloud Infrastructure Console, then click an available Oracle Integration instance to view available functions.
  2. In the Invoke endpoint column, view the function endpoint URL to invoke. For this example, the function is named node-thumbnail. The node-thumbnail function generates a thumbnail out of an image.
  3. Copy the URL. You use this URL to call the function from an integration.
  4. Create an orchestrated integration that accepts an image and generates a thumbnail from that image. When the integration is invoked, both the original image and the generated thumbnail are uploaded to the object storage bucket in Oracle Cloud Infrastructure.
  5. Configure the REST Adapter as an invoke connection in the integration.
    1. On the Basic Info page, configure the REST Adapter invoke connection to handle request and response payloads.
      • Configure a request payload for this endpoint
      • Configure this endpoint to receive the response
    2. On the Request page, select application/octet-stream as the media type that you want the endpoint to send (this is a binary input stream).
    3. On the Response page, select application/octet-stream as the media type to which you want the endpoint to reply (this is also a binary input stream).
  6. Configure the mapper as follows:
    1. Map the source attachmentReference element to the target streamReference for thumbnail generation.
      source attachmentReference mapped to target streamReference
    2. Configure the target AbsoluteEndpointURI element to call the node-thumbnail function invoke endpoint URL copied in Step 3.
      AbsoluteEndpointURI target element in mapper

  7. Design the remaining portions of the integration.
  8. Activate and invoke the integration to call the function.
    1. On the Integrations page, click How to run icon at the far right to show the endpoint URL.
    2. Copy the endpoint URL to an application to invoke the integration, such as Postman.
      Endpoint URL link is shown on the Endpoint Description dialog

  9. Go to Storage > Buckets in the Oracle Cloud Infrastructure Console.
  10. Click the object storage bucket instance.
  11. Refresh the page and note that the original image (for this example, named test_image_1.png) and the generated thumbnail (for this example, named thumbnail-test_image_1.png) are now both displayed in the Objects table.