Rest Task in Data Integration for Publishing Notifications and much more
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;
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.
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.
On the headers tab, add a header for the content-type to be application/json
Then on the request body we will add the publish message payload which is a JSON payload with title property and body property;
We can parameterize the request body also and then this will be a useful task that can support different notification bodies and topics.
Below I have used the default success condition.
Change the authentication to use 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.
Below I have set my topic and also changed the body, let’s see what happens..
In my topic I used an email notification like below with the information I added in the request body.
That’s it, you can then schedule these tasks, use them in pipelines and conditionally execute on paths like this;
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.