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 can take an application/octet-stream for an image, save it to Oracle Cloud Infrastructure object storage, and send the image to an Oracle Cloud Infrastructure function that can create a thumbnail and save 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 One Console of Oracle Cloud Infrastructure, then click an available Oracle Integration instance to view available functions.
  2. In the Invoke endpoint column, click Show to view the node-thumbnail function endpoint URL to invoke. 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.
      The Configure a request payload for this endpoint and Configure this endpoint to receive the response options are selected.

    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 Object Storage > Object Storage in the One Console of Oracle Cloud Infrastructure.
  10. Click the object storage bucket instance.
  11. Refresh the page and note that the original image (test_image_1.png) and the generated thumbnail (thumbnail-test_image_1.png) are now both displayed.