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.
- Go to Developer Services > Functions in the One Console of Oracle Cloud Infrastructure, then click an available Oracle Integration instance to view available functions.
- 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.
- 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.
- 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
.
- On the Integrations page, click
- Go to Object Storage > Object Storage in the One Console of Oracle Cloud Infrastructure.
- Click the object storage bucket instance.
- 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.