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.
- Go to Developer Services > Functions in the Oracle Cloud Infrastructure Console, then click an available Oracle Integration instance to view available functions.
- 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.
- Copy the URL. You use this URL to call the function from an integration.
- 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.
- Configure the REST Adapter as an invoke connection in the integration.
- 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
- 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).
- 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).
- On the Basic Info page, configure the REST Adapter invoke connection to handle request and response payloads.
- Configure the mapper as follows:
- Map the source attachmentReference
element to the target streamReference for
thumbnail generation.
- Configure the target
AbsoluteEndpointURI element to call the
node-thumbnail function invoke endpoint URL
copied in Step 3.
- Map the source attachmentReference
element to the target streamReference for
thumbnail generation.
- Design the remaining portions of the integration.
- Activate and invoke the integration to call the function.
- On the Integrations page, click at the far right to show the endpoint URL.
- Copy the endpoint URL to an application to invoke the
integration, such as
Postman
.
- Go to Storage > Buckets in the Oracle Cloud Infrastructure Console.
- Click the object storage bucket instance.
- 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.