Rest Task in Data Integration for Publishing Notifications and much more

David Allan
4 min readJan 25, 2022

Within the OCI Data Integration service, one of the most useful tasks is the REST Task, here we can extend data integration to call all kinds of activities. OCI is available via REST, so services such as Object Storage and Notification service can be manipulated via REST. OCI Functions also expose an endpoint for functions, so custom business logic can easily be added and executed via REST also. The notification service has a good overview here.

See the endpoints for your region and for the service you are using;

Within Data Integration you can create a REST Task from the home page of your workspace or from within a project;

Create REST Task for integrating all kinds of work

A dialog will appear where you can define the HTTP method to use, the URL, the URL parameters, the headers and the payload. You can also define the authentication mechanism and the success criteria.

Create REST Task

In this example I am going to use the publish message REST API from the notification service. I will also parameterize the topic ID so that I can use the task to publish different messages to different topics. Below you can see how I used ${TOPICID} in the URL (press return at end of URL) and a URL parameter added to the table of URL parameters below.

Define the POST URL for publishing a message

On the headers tab, add a header for the content-type to be application/json

Add a header for content-type

Then on the request body we will add the publish message payload which is a JSON payload with title property and body property;

Define the payload body default value

We can parameterize the request body also and then this will be a useful task that can support different notification bodies and topics.

Add a parameter for the payload body

Below I have used the default success condition.

Define the success condition status ≥200 and ≤300

Change the authentication to use OCI resource principal;

Define the authentication using OCI resource principal

You will need to add a policy in order to execute this task, for example I added use on notification family for my workspaces — this can be further refined;

allow any-user to use notification-family in tenancy where ALL {request.principal.type = ‘disworkspace’}

Publish the task to an application, then when you run you will be prompted for a topic and a payload body. You can set these and execute.

Run the task, enter parameters for topic Id and payload body

Below I have set my topic and also changed the body, let’s see what happens..

Define the payload body

In my topic I used an email notification like below with the information I added in the request body.

Example email from notification subscription

That’s it, you can then schedule these tasks, use them in pipelines and conditionally execute on paths like this;

Pipeline with conditional branches and REST operators

They are useful to incorporate all kinds of other REST activities. See this blog here for a collection of REST Tasks for OCI that includes the publish example;

Postman Collection of REST Tasks for OCI Data Integration

OCI Functions is a great way of adding custom business logic and they are automatically exposed with REST endpoints also! As you have seen here in the OCI Data Integration service, one of the most useful tasks is the REST Task, here we can extend data integration to call all kinds of activities. Hope you found this post useful.

--

--

David Allan

Architect at @Oracle The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.